import math def seisuwa(N): M = (N / 2) * (N - 1) M = int(M) Nl = [] for i in range(1, int(math.sqrt(N)) + 1): if N % i == 0: Nl.append(i) Nl.append(N // i) Nl = sorted(Nl) for j in range(1, len(Nl) + 1): if M % Nl[-j] == 0: ans = Nl[-j] break return ans def main(): N = int(input()) print(seisuwa(N)) if __name__ == '__main__': main()