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 isprime(long long r) {
  long long i;
  if (r == 0 || r == 1)
    return false;
  else {
    for (i = 2; i * i <= r; i++) {
      if (r % i == 0) {
        return false;
        break;
      }
    }
    return true;
  }
}
int main() {
  long long n;
  cin >> n;
  vector<long long> v{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37};
  long long k = 0;
  long long remainder;
  if (n % 2 == 0) {
    cout << n / 2 << endl;
    return 0;
  }
  for (int i = 1; i < v.size(); i++) {
    if (n % v[i] == 0) {
      cout << "Hello\n";
      n -= v[i];
      k++;
      if (n % 2 == 0) {
        cout << (n / 2) + k << endl;
        break;
      } else if (v[i] != v[1] && n % v[1] == 0) {
        cout << (n / v[1]) + k << endl;
        break;
      } else if (v[i] != v[2] && n % v[2] == 0) {
        cout << (n / v[2]) + k << endl;
        break;
      } else if (v[i] != v[3] && n % v[3] == 0) {
        cout << (n / v[3]) + k << endl;
        break;
      } else if (v[i] != v[4] && n % v[4] == 0) {
        cout << (n / v[4]) + k << endl;
        break;
      } else {
        cout << (n / v[i]) + k << endl;
        break;
      }
    }
  }
}
