#include<iostream>
using namespace std;

int main () {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;

    int skip = 1;
    for (int mul = 2; 1; mul++) {
        skip *= mul;
        if (skip > n) {
            skip /= mul;
            cout << n - (n % skip) + 1;
            break;
        }
    }
    return 0;
}
