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;
const int MX = 2e6 + 10;
const int mod = 1e9 + 7;
const long long int inf = 1LL << 62;
int dx4[] = {0, 0, -1, 1};
int dy4[] = {1, -1, 0, 0};
int dx[] = {1, 1, 1, 0, 0, -1, -1, -1};
int dy[] = {1, 0, -1, 1, -1, 1, 0, -1};
map<long long int, vector<long long int> > mp;
vector<long long int> v, v1;
priority_queue<pair<long long int, long long int> > PQ, PQ1;
int dis(int n) {
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    if (mp[a].size() == 0) {
      mp[a].push_back(0);
      v.push_back(a);
    } else
      mp[a].push_back(0);
  }
}
int pow1(int a, int b) {
  long long int ans = 1;
  while (b--) ans = ans * a;
  return ans;
}
int pow2(int n) {
  int ans = -1;
  while (n > 0) {
    n = n / 2;
    ans++;
  }
  return ans;
}
vector<long long int> v2, v3;
vector<int> prime_factors;
int mark[1000000 + 6], prime[1000000];
int sieve() {
  int i, j;
  for (i = 0; i < 1000000; i++) mark[i] = 0;
  mark[0] = mark[1] = 1;
  for (i = 4; i < 1000000; i = i + 2) mark[i] = 1;
  for (i = 3; i * i <= 1000000; i = i + 2) {
    if (mark[i] == 0) {
      for (j = i * i; j <= 1000000; j = j + i + i) mark[j] = 1;
    }
  }
  j = 0;
  for (i = 2; i < 1000000; i++)
    if (mark[i] == 0) prime[j++] = i;
}
int main() {
  long long int n, m, k, q, t, cnt = 0, sum = 0, ans = 0, mx = -inf, mn = inf,
                               a, b, c, d, e, f, g, h, i, j, x, y, z, temp,
                               temp1;
  string s, s1, s2, s3;
  sieve();
  cin >> n;
  j = 0;
  m = n;
  if (n % 2 == 0)
    cout << n / 2 << endl;
  else {
    while (prime[j] * prime[j] <= n) {
      if (n % prime[j] == 0) {
        temp = j;
        n = 0;
        break;
      }
      j++;
    }
    if (n > 0) {
      cout << 1 << endl;
    } else
      cout << m / prime[temp] << endl;
  }
  return 0;
}
