
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
int cnt2,cnt5;
int main() {
ll res = 1;
scanf("%lld", &n);
for (int i = 1; i <= n; i++) {
int tmp = i;
while (tmp % 2 == 0) {
cnt2++;
tmp /= 2;
}
while (tmp % 5 == 0) {
cnt5++;
tmp /= 5;
}
res = res * tmp % 10;
}
for (int i = 1; i <= cnt2 - cnt5; i++) res = res * 2 % 10;
printf("%lld\n", res);
return 0;
}
/*————————————————
版权声明:本文为CSDN博主「Amber0130」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43601103/article/details/113066864*/