def h(d, s, a, t):
if d == 1:
print('{} {}'.format(s, t))
return
h(d - 1, s, t, a)
print('{} {}'.format(s, t))
h(d - 1, a, s, t)
n=int(input())
print(2**n-1)
h(n,'1','2','3')
ZGVmIGgoZCwgcywgYSwgdCk6CiAgICBpZiBkID09IDE6CiAgICAgICAgcHJpbnQoJ3t9IHt9Jy5mb3JtYXQocywgdCkpCiAgICAgICAgcmV0dXJuCiAKICAgIGgoZCAtIDEsIHMsIHQsIGEpCiAgICBwcmludCgne30ge30nLmZvcm1hdChzLCB0KSkKICAgIGgoZCAtIDEsIGEsIHMsIHQpCiAKbj1pbnQoaW5wdXQoKSkKcHJpbnQoMioqbi0xKQpoKG4sJzEnLCcyJywnMycp