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.
import java.io.*;
import java.util.*;
public class moon {
//	long ans = 0 ;
//	static long rec( long x )
//	{
//		
//	}
	public static void main(String[] args) throws FileNotFoundException 
	{
		// TODO Auto-generated method stub
		LetsDoIt in = new LetsDoIt();
//      Scanner in = new Scanner(System.in) ;
//      FastReaderFile in = new FastReaderFile(new FileInputStream("fun.in")) ;
//      out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("output.txt")), true) ;
		out = new PrintWriter(new BufferedOutputStream(System.out), true) ;
//		int t = in.nextInt() ;
//		while ( t-- > 0 ) {
//		int x = in.nextInt() ;
//		if ( x*x >= 4*x )
//		{double a = (x + Math.sqrt(x*x-4*x))/2 ;
//		out.println( "Y " + a  + " " + (x-a));}
//		else
//			out.println("N");}
		long x = in.nextLong() ;
		long ans = 0 , y ;
		for ( long i = 2 ; i * i <= x  ; ++i )
		{
			if ( x % i == 0 )
			{
				y = x/i ;
				ans += y ;
				x -= (y * i) ;
			}
		}
		if ( x == 0 )
			out.println(ans);
		else
			out.println(ans+1);
	}

    static long nCk( long n, long k )
    {
	    if (k > n) return 0;
	    if (k * 2 > n) k = n-k;
	    if (k == 0) return 1;
	
	    long result = n;
	    for( long i = 2; i <= k; ++i ) {
	        result *= (n-i+1);
	        result /= i;
	    }
	    return result;
    }
    static  boolean isPrime( long n)
    {
        if (n < 2)  return false;
        if (n < 4)  return true;
        
        if (n%2 == 0 || n%3 == 0) return false;

        for (long i = 5 ; i * i <= n ; i = i + 6 )
            if ( n % i == 0 || n % ( i + 2 ) == 0)
                return false ;

        return true;
    }
    static long gcd(long a, long b) 
    {
        return b == 0 ? (a < 0 ? -a : a) : gcd(b, a % b);
    }
    static long lcm(long a, long b)
    {
        long lcm = (a / gcd(a, b)) * b;
        return lcm > 0 ? lcm : -lcm ;
    }
	public static class FastReaderFile
    {
        BufferedReader br;
        StringTokenizer st;
        public FastReaderFile(InputStream in)
        {
            br = new BufferedReader(new
            InputStreamReader(in));
            
        }
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static class LetsDoIt
    {
        BufferedReader br;
        StringTokenizer st;

        public LetsDoIt()
        {
            br = new BufferedReader(new
                                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static PrintWriter out;
    static void full( long[] x , LetsDoIt in )
    {
    	for ( int i = 0 ; i < x.length ; ++i )
    		x[i] = in.nextLong();
    }
    static void fullint( int[] x , LetsDoIt in )
    {
    	for ( int i = 0 ; i < x.length ; ++i )
    		x[i] = in.nextInt();
    }
}
