while True:
    try:
        n = int(input())
        if n < 3:
            print(-1)
            continue
        res, temp = [1, 1, 1], []
        for _ in range(3, n+1):
            res = [0] + res + [0]
            i, Max = 0, len(res)
            while i + 2 <= Max:
                temp.append(sum(res[i:i+3]))
                i += 1
            res = [1] + temp + [1]
            temp = []
        for i, n in enumerate(res):
            if n % 2 == 0:
                print(i+1)
                break
    except:
        break