program zzn;
var
n,i,j:longint;
f:array[0..1000000]of longint;
procedure init;
begin
assign(input,'binacy.in');
reset(input);
assign(output,'binacy.out');
rewrite(output);
readln(n);
end;
procedure closef;
begin
close(input);
close(output);
end;
procedure main;
begin
f[0]:=0;
f[1]:=1;
f[2]:=2;
if n<=2 then
begin
writeln(f[n]);
exit;
end;
for i:=3 to n do
begin
f[i]:=(f[i-1]+f[i-2])mod 15746;
end;
writeln(f[n]);
end;
begin
init;
main;
closef;
end.