#思路:画几行找规律
a=int(input())
if a<=2:
    print("-1")
else:
    print([2,3,2,4][(a-2)%4-1])