#include <iostream>
using namespace std;
int main() {
    int n;
    unsigned long long pr = 1;
    cin >> n;
    for(int i = 1; i * i < n; i++){
        pr *= i;
    }
    pr /= i - 1;
    cout<<n - n % pr + 1<<endl;
    return 0;
}
