#R, 47 bytes n=scan();if(!n,1,floor(gamma(n+1)/exp(1)+.5)) Uses the same formula as Mego's answer.
Alternate method, 52 bytes using the PerMallows library
n=scan();`if`(!n,1,PerMallows::count.perms(n,n,'h')) #R, 47 bytes n=scan();if(!n,1,floor(gamma(n+1)/exp(1)+.5)) Uses the same formula as Mego's answer.
Alternate method, 52 bytes using the PerMallows library
n=scan();`if`(!n,1,PerMallows::count.perms(n,n,'h'))