LearnPy Hub
← Arena
IntermediateRating 1300

Gray Code

Print the n-bit Gray code sequence (each number differs from the previous one in exactly one bit), starting at 0, as integers: g(i) = i ^ (i >> 1).

Input

One integer n (1 ≤ n ≤ 8).

Output

One line.

Sample 1

Input
2
Output
0 1 3 2

Sample 2

Input
1
Output
0 1
solution.py
Output appears here
Gray Code · Python Arena problem · LearnPy Hub