uses crt;
var n,i:longint;
s:real;
{------------ham-tinh-giai-thua---------------------}
function gthua(x:longint):real;
var i:longint;
gt:real;
begin
gt:=1;
for i:=1 to x do
gt:=gt*i;
gthua:=gt;
end;
{------------chuong-trinh-chinh------------------}
begin
clrscr;
write('Nhap n='); readln(n);
s:=0;
for i:=1 to n do
s:=s+gthua(i);
writeln(s:0:0);
readln;
end.