You are given an integer number n. The following algorithm is applied to it:

  1. if n = 0, then end algorithm; 
  2. find the smallest prime divisor d of n; 
  3. subtract d from n and go to step 1. 



Determine the number of subtrations the algorithm will make.

Input

The only line contains a single integer n (2 ≤ n ≤ 10^{10}).

Output

Print a single integer — the number of subtractions the algorithm will make.

Examples

Input


5


Output


1


Input


4


Output


2

Note

In the first example 5 is the smallest prime divisor, thus it gets subtracted right away to make a 0.

In the second example 2 is the smallest prime divisor at both steps.
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ld = long double;
using ulli = unsigned long long int;
void debug() { cerr << endl; }
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
template <typename T, typename... hello>
void debug(T arg, const hello &...rest) {
  cerr << arg << ' ';
  debug(rest...);
}
const int maxN = 1e6;
lli isVisited[maxN / 64 + 200];
vector<int> primes;
void bitwise_sieve_gen(int limit) {
  limit += 100;
  for (lli i = 3; i <= sqrt(limit); i += 2) {
    if (!(isVisited[i / 64] & (1LL << (i % 64)))) {
      for (long long j = i * i; j <= limit; j += 2 * i) {
        isVisited[j / 64] |= (1LL << (j % 64));
      }
    }
  }
  primes.emplace_back(2);
  for (lli i = 3; i <= limit; i += 2) {
    if (!(isVisited[i / 64] & (1LL << (i % 64)))) {
      primes.emplace_back(i);
    }
  }
}
int smallest_prime(int n) {
  int ans = -1;
  for (auto i : primes) {
    if (i * i > n) {
      break;
    }
    if (n % i == 0) {
      ans = i;
      break;
    }
  }
  if (ans == -1) {
    return n;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  bitwise_sieve_gen(maxN);
  lli n;
  cin >> n;
  cout << n / smallest_prime(n);
}
