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.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 16 14:02:19 2018

@author: umang
"""
nums = [i for i in range(10**5+1)]
primes = []

def sieve(nums, primes):
    i = 2
    while i < 10**5+1:
        if nums[i] != -1:
            primes.append(i)
            n = 1
            temp = n*i
            while temp < 10**5+1:
                nums[temp] = -1
                n += 1
                temp = n*i
        i += 1
    return primes

primes = sieve(nums, primes)

def find_smallest_div(n, primes):
    for i in primes:
        if n%i == 0:
            return i

def func(n):
    count = 0
    if n == 0:
        return count
    else:
        '''while(n != 0):
            d = find_smallest_div(n)
            n -= d
            count += 1
        return count'''
        d = find_smallest_div(n, primes)
        return n//d
    
n = int(input())

print(func(n))