def func(): n = int(input()) if n <= 2: print(-1) else: reslist = [2, 3, 2, 4] key = (n-2)%4 print(reslist[key-1]) if __name__ == "__main__": func()