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.
//package ;
import java.io.*;
import java.util.*;

import java.awt.*;

public class B
{
	static Pair fun(long n)
	{
		for(int x:p)
		{
			if(n==x)
				return new Pair(0, 0);
			if(n%x==0)
				return new Pair(n/x,x);
		}
		return new Pair(0, 0);
	}
	public static void main(String[] args) throws IOException 
	{
		Scanner sc = new Scanner();
		PrintWriter pw = new PrintWriter(System.out);
		hs=new HashSet<>();
		p=new ArrayList<>();
		modified_seive(100000);
//		System.out.println("yes");
		long n=sc.nextLong();
		long ans=0;
		for(int x:p)
		{
			
			if(n%x==0)
			{
				System.out.println(n/x);
				return;
			}
		}
		System.out.println(1);
//		System.out.println(ans++);
		pw.close();    
	}
	static class Pair
	{
		long n;long x;
		public Pair(long n,long x) {
			// TODO Auto-generated constructor stub
			this.x=x;this.n=n;
		}
	}
//	10000000000
//	3333333329
	static HashSet<Integer> hs ;
	static ArrayList<Integer>p;
	public static void modified_seive(int size)
	{
		boolean f[]=new boolean[size];
		f[0]=true;
		f[1]=true;
		for(int i=2;i<f.length;i++)
		{	
			if(!f[i])
			{
				p.add(i);
				hs.add(i);
				for(int j=i,z=1;i * z<f.length;z++)
				{
					f[j]=true;
					int tmp = i * z;
					j = tmp;
//					pf[j]++;//the only add to be modified
				}
			}
		}
	}
	static class Scanner {
		BufferedReader br;
		StringTokenizer st;
		
		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}
		
		int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
		
		long nextLong() throws IOException {
			return Long.parseLong(next());
		}
		
		double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
		
		String nextLine() throws IOException {
			return br.readLine();
		}
		boolean hasnext() throws IOException{
			return br.ready();
		}
		
	}
}
