#include <iostream>
using namespace std;
long hcf(long a, long b) {
if (a == 0)
return b;
else if (b == 0)
return a;
else {
return hcf(b, a % b);
}
}
long lcm(long a, long b) {
// comment
return a * b / hcf(a, b);
}
int main() {
long n;
cin >> n;
if (n == 1)
cout << "1\n";
else if (n == 2)
cout << "2\n";
else if (n == 3)
cout << "6\n";
else if (n % 2 != 0)
cout << n * (n - 1) * (n - 2) << "\n";
else {
long maxv = (n - 1) * (n - 2) * (n - 3);
for (long v1 = n; v1 >= n - 10 && v1 >= 1; v1--) {
for (long v2 = v1 - 1; v2 >= n - 10 && v2 >= 1; v2--) {
for (long v3 = v2 - 1; v3 >= n - 10 && v2 >= 1; v3--) {
long mcl = lcm(lcm(v1, v2), v3);
if (mcl > maxv) {
maxv = mcl;
}
}
}
}
cout << maxv << "\n";
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmxvbmcgaGNmKGxvbmcgYSwgbG9uZyBiKSB7CiAgaWYgKGEgPT0gMCkKICAgIHJldHVybiBiOwogIGVsc2UgaWYgKGIgPT0gMCkKICAgIHJldHVybiBhOwogIGVsc2UgewogICAgcmV0dXJuIGhjZihiLCBhICUgYik7CiAgfQp9CmxvbmcgbGNtKGxvbmcgYSwgbG9uZyBiKSB7CiAgLy8gY29tbWVudAogIHJldHVybiBhICogYiAvIGhjZihhLCBiKTsKfQoKaW50IG1haW4oKSB7CiAgbG9uZyBuOwogIGNpbiA+PiBuOwogIGlmIChuID09IDEpCiAgICBjb3V0IDw8ICIxXG4iOwogIGVsc2UgaWYgKG4gPT0gMikKICAgIGNvdXQgPDwgIjJcbiI7CiAgZWxzZSBpZiAobiA9PSAzKQogICAgY291dCA8PCAiNlxuIjsKICBlbHNlIGlmIChuICUgMiAhPSAwKQogICAgY291dCA8PCBuICogKG4gLSAxKSAqIChuIC0gMikgPDwgIlxuIjsKICBlbHNlIHsKICAgIGxvbmcgbWF4diA9IChuIC0gMSkgKiAobiAtI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