program SuperFibonac;
  const DF = 'super.in';
        RF = 'super.out';
        max = 20;
  var f: text;
      N, i: 1..max;
      fi, f3, f2, f1: longint;
begin
  { skaitymas }
  assign(f, DF);
  reset(f);
  readln(f, N);
  close(f);
  
  { sprendimas }
  f1 := 1; f2 := 1; f3 := 1; fi := 1;
  for i := 4 to N do
    begin
      fi := f3 + f2 + f1;
      f1 := f2;
      f2 := f3;
      f3 := fi
    end;
  assign(f, rez);
  rewrite(f);
  writeln(f, fi);
  close(f)
end.
