N = int(input()) print(0 if N < 2 else N-1 if N%2 == 0 else N-3)