import java.util.*;
import java.math.*;
class Main
{
public static void main(String[] args)
{
int n,i;
long ans;
BigInteger sum,tmp;
Scanner scan=new Scanner(System.in);
while(scan.hasNextInt())
{
n=scan.nextInt();
ans=0;
sum= BigInteger.valueOf(1);
for(i=2;i<=n;i++)
{
tmp = BigInteger.valueOf(i);
sum=sum.multiply(tmp);
}
String result = sum.toString();
char[] characters=result.toCharArray();
for(i=0; i<result.length(); i++)
ans +=characters[i]-'0';
System.out.println(ans);
}
}
}
No comments:
Post a Comment