""" The key here is to realize that the answer follows a pattern of '2 3 2 4' after n = 2. """ n = int(input()) if n < 3: print(-1) elif n%2 == 1: print(2) elif n%4 == 0: print(3) else: print(4)