#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
using namespace std;
const int n=1000;
char a[n];
int i,j,k;
int t,s;
int main()
{
int m;
cin >> m;
memset(a,0,sizeof(a));
t=0,s=0;
a[0]=1;
for(i=1; i<=m; i++)//计算:模仿手算乘法
for(j=0; j<n; j++)
{
s=a[j]*i+t;
a[j]=s%10;
t=s/10;
}
for(i=n-1;i>-1&&!a[i];i--)
;
string s="";
j=i;
for(; i>-1;i--)
s+=a[i]+'0';
cout << s << endl;
int c=0;
reverse(s.begin(),s.end());//求这个数后几位有几个0
for(i=0;i<=j;i++)
{
if(s[i]=='0')
c++;
else
break;
}
cout << c << endl;
return 0;
}