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;
#define ll long long
#define ull unsigned long long
#define ld long double
#define d double
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define IOS ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define sc scanf
#define pf printf
const int N = 1e5 + 5;
const int inf = 1e9 + 1;
const int prime_100000000 = 5761460;
const double eps = 1e-15;
const double EPS = 1e-9;
const double PI = acos(-1.0);
int isprime(int n)
{
    static int i;
    static long long j;
    j = sqrt(n);
    for(i = 2; i <= j; i++)
        if(n%i == 0)
            return 0;
    return 1;
}
int main()
{
    IOS
    ll n;
    cin>>n;
    if(n%2==0)
    {
        cout<<n/2<<endl;
        return 0;
    }
    else
    {
        for(ll i=3 ; i<=n; i+=2)
        {
            if(isprime[i]&& n% i==0)
            {
                cout<<n/i<<endl;
                break;
            }
        }
    }
}
