#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, x;
  cin >> n;
  if (n == 1)
    cout << 1 << "\n";
  else if (n == 2)
    cout << 2 << "\n";
  else {
    x = n - 1;
    while (n % x == 0) {
      x--;
    }
    cout << n - x << "\n";
  }
  return 0;
}
