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.lang.reflect.Array;
import java.util.*;
import java.math.*;
import java.lang.*;
import java.util.stream.Collectors;

import static java.lang.Math.*;

public class Main implements Runnable
{
    static class InputReader
    {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream)
        {
            this.stream = stream;
        }

        public int read()
        {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars)
            {
                curChar = 0;
                try
                {
                    numChars = stream.read(buf);
                }
                catch (IOException e)
                {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-')
            {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do
            {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do
            {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
            return res * sgn;
        }

        public double nextDouble()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-')
            {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.')
            {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.')
            {
                c = read();
                double m = 1;
                while (!isSpaceChar(c))
                {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString()
        {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do
            {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c)
        {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next()
        {
            return readString();
        }

        public interface SpaceCharFilter
        {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception
    {
        new Thread(null, new Main(),"Main",1<<27).start();
    }

    public static long gcd(long a, long b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }

    public static long findGCD(long arr[], int n)
    {
        long result = arr[0];
        for (int i = 1; i < n; i++)
            result = gcd(arr[i], result);
        return result;
    }

    static void sortbycolomn(long arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<long[]>() {

            @Override

            public int compare(final long[] entry1,
                               final long[] entry2) {


                if (entry1[col] > entry2[col])
                    return 1;
                else
                    return -1;
            }
        });
    }

    static String sortString(String str) {
        int MAX_CHAR = 256;
        int letters[] = new int[MAX_CHAR];
        for (char x : str.toCharArray()) {

            // 'a'-'a' will be 0, 'b'-'a' will be 1,
            // so for location of character in count
            // array we will do str[i]-'a'.
            letters[x - 'a']++;
        }

        // Traverse the hash array and print
        // characters
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < MAX_CHAR; i++) {
            for (int j = 0; j < letters[i]; j++) {
                sb.append((char) (i + 'a'));
            }
        }
        return sb.toString();
    }
    public int lb(int[] a, int val){
        int min = 0, len = a.length, max = len;
        while(min<max){
            int mid = min + (max-min)/2;
            if(a[mid]>=val){
                max = mid;
            }
            else{
                min = mid+1;
            }
        }
        return max;
    }
    public int ub(int[] a, int val){
        int min = 0, len = a.length, max = len;
        while(min<max){
            int mid = min + (max-min)/2;
            if(a[mid]>val){
                max = mid;
            }
            else {
                min = mid + 1;
            }
        }
        return max;
    }
    public int lb(List<Integer> a, int val){
        int min = 0, len = a.size(), max = len;
        while(min<max){
            int mid = min + (max-min)/2;
            if(a.get(mid)>=val){
                max = mid;
            }
            else{
                min = mid+1;
            }
        }
        return max;
    }
    public int ub(List<Integer> a, int val){
        int min = 0, len = a.size(), max = len;
        while(min<max){
            int mid = min + (max-min)/2;
            if(a.get(mid)>val){
                max = mid;
            }
            else {
                min = mid + 1;
            }
        }
        return max;
    }
    public void run()
    {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long n = in.nextLong();
        long i = 2, steps = 0;
        while(n>0){
            if(n%i==0) {
                long c = n/i;
                steps+=c;
                n -= c*i;
            }
            else if(i*i>n) {
                steps = 1;
                break;
            }
            i++;
        }
        w.println(steps);
        w.flush();
        w.close();
    }
}