#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> b(1, 0);
for (int i = 1; i <= n; ++i) {
vector<int> a(1, 1); // Reset a for each new factorial calculation
int carry = 0;
for (int j = 2; j <= i; ++j) {
carry = 0;
for (int k = 0; k < a.size(); ++k) {
int prod = a[k] * j + carry;
a[k] = prod % 10;
carry = prod / 10;
}
while (carry) {
a.push_back(carry % 10);
carry /= 10;
}
}
carry = 0;
b.resize(max(b.size(), a.size()), 0);
for (int k = 0; k < a.size(); ++k) {
int sum = b[k] + a[k] + carry;
b[k] = sum % 10;
carry = sum / 10;
}
while (carry) {
b.push_back(carry % 10);
carry /= 10;
}
}
//前导0处理
while (b.size() > 1 && b.back() == 0) b.pop_back();
for (int i = b.size() - 1; i >= 0; --i) cout << b[i];
cout << endl;
return 0;
}