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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Solution {
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long n = parseLong(br.readLine());
		
		List<Integer> list = sieveOfEratosthenes(100001);
		int numSubs = 0;
		
		while (n > 0) {
			int i = 0;
			for (i = 0; i < list.size(); i++) {
				if (n % ((long) list.get(i)) == 0L) {
					break;
				}
			}
			if (i == list.size()) break;
			n -= (long) list.get(i);
		}
		
		System.out.println(numSubs);
		
	}
	
	public static List<Integer> sieveOfEratosthenes(int n) 
    {
        boolean prime[] = new boolean[n+1]; 
        for(int i=0;i<n;i++) 
            prime[i] = true; 
          
        for(int p = 2; p*p <=n; p++) 
        { 
            // If prime[p] is not changed, then it is a prime 
            if(prime[p] == true) 
            { 
                // Update all multiples of p 
                for(int i = p*2; i <= n; i += p) 
                    prime[i] = false; 
            } 
        } 
          
        // Print all prime numbers 
        for(int i = 2; i <= n; i++) 
        { 
            if(prime[i] == true) 
                System.out.print(i + " "); 
        } 
        
        ArrayList<Integer> primes = new ArrayList<Integer>();
        for (int i = 1; i < prime.length; i++) {
        	if (prime[i]) primes.add(i);
        }
        return primes;
    }
	
	public static boolean checkAns(double a, double b, double d) {
		double minVal = 0.000001;
		return Math.abs(a + b - d) <= minVal && Math.abs(a * b - d) <= minVal;
	}
	
	public static int parseInt(String a) {
		return Integer.parseInt(a);
	}
	
	public static long parseLong(String a) {
		return Long.parseLong(a);
	}

}
