n = int(input()) n1, n2 = n, n * (n-1) // 2 res = 1 for i in range(2, n+1): if n1 % i == n2 % i == 0: res = i print(res)