import math def main(): n = int(input()) ans = n for i in range(3, int(math.sqrt(n)) + 1): if n % i == 0: ans = i break print(ans // 2 if n % 2 == 0 and n > 4 else ans) if __name__ == '__main__': main()