import math def isPrime(n): last = math.floor(n ** 0.5) for i in range(2, last + 1): if n % i == 0: return False return True N = int(input()) if N == 0: print(-1) exit() a = [] while N > 7: b = N - 1 while not isPrime(b): b += 1 a.append(b) N ^= (b + 1) if N >= 4: a.append(3) N ^= 4 if N == 1: a.append(1) elif N == 2: a.append(2) a.append(1) elif N == 3: a.append(2) print(*a)