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;
bool checker[1000010];
vector<int> primes;
void sieve(long long int mx) {
  long long int sq = sqrt(mx) + 2;
  primes.push_back(2);
  checker[0] = checker[1] = true;
  for (long long int i = 4; i <= mx; i += 2) checker[i] = true;
  for (long long int i = 3; i <= mx; i += 2) {
    if (!checker[i]) {
      primes.push_back(i);
      if (i <= sq) {
        for (long long int j = i * i; j <= mx; j += i * 2) checker[j] = true;
      }
    }
  }
}
long long int ans = 0LL;
void solve(long long int n) {
  if (n <= 0) return;
  for (int i = 0; primes[i] <= sqrt(n) + 1; i++) {
    if (n % primes[i] == 0) {
      ans++;
      solve(n - primes[i]);
      return;
    }
  }
  if (n >= 1) {
    ans++;
    return;
  }
}
bool isPrime(long long int n) {
  long long int sq = sqrt(n) + 1;
  for (long long int i = 2; i <= sq; i++)
    if (n % i == 0) return false;
  return true;
}
int main() {
  long long int n;
  cin >> n;
  if (isPrime(n) or n == 1)
    cout << 1 << '\n';
  else {
    if (n % 5 == 0 and (n / 5) % 2 == 0)
      ans = long long int(n / 2) - 1;
    else
      ans = n / 2;
    cout << ans << '\n';
  }
  return 0;
}
