# 20240622 n = int(input()) if (n ==1 or n ==2): print(-1) else: if n%4 == 3 or n%4 ==1: print(2) elif n%4 == 0: print(3) else: print(4)