program bly(input,ouput);
type
t1=array[1..60] of integer;
var
g:t1;
f1,f2:text;
i,j:integer;
long,n:integer;
procedure cheng(a:t1);
var
i0:integer;
begin
for i0:=1 to long do begin
g[i0]:=g[i0]*2;
end;
for i0:=1 to long do begin
g[i0+1]:=g[i0+1]+g[i0] div 10;
g[i0]:=g[i0] mod 10;
end;
long:=61;
repeat dec(long) until g[long]<>0;
end;
begin
assign(f1,'hanoi.in');
reset(f1);
readln(f1,n);
close(f1);
long:=1;
g[1]:=2;
for i:=1 to n do cheng(g);
if g[1]>=2 then g[1]:=g[1]-2
else begin dec(g[2]); g[1]:=g[1]+8; end;
assign(f2,'hanoi.out');
rewrite(f2);
for i:=long downto 1 do begin
write(f2,g[i]);
end;
close(f2);
end.