N = int(input()) import sys for i in [3,5,6,7,9,11]: if i >= N: print(-1) exit() a = N - i if a != (a & -a): print(i) exit() print(-1)