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>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define all(a) 			a.begin(),a.end()
#define pb 				push_back
#define vi				vector<int>
#define vl 				vector<long long>
#define MOD 			1000000007
#define FOR(i,a,b) 		for(int i = a; i < b ; i++)
#define forn(i,n) 		for(int i = 0 ; i < n; i++)
#define br 				cout<<endl;
#define testc()			int t;cin>>t;while(t--)
#define ll				long long
#define printv(v)		for(auto x : v) cout<<x<<' ';br;
#define fi				first
#define sec 			second
#define fast 			ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define vb 				vector<bool>

using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



int main()
{
	ll n;cin>>n;
	for(int i = 2 ; i * i <= n ;i++)
	{
		if(n % i == 0)
		{
			cout<<n / i<<endl;
			return 0;
		}
	}
	cout<<1<<endl;

}