#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-5;
const int inf = (1 << 31) - 1;
const int hinf = 1000000000;
const int mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  return a % b == 0 ? b : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  long long n;
  cin >> n;
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  if (n == 2) {
    cout << 2 << endl;
    return 0;
  }
  if (n % 2 == 0 && n % 3 == 0) {
    cout << lcm(n - 1, lcm(n - 2, n - 3)) << endl;
    return 0;
  }
  long long ans = n * (n - 1);
  long long ta = n * (n - 1);
  for (long long i = n - 2; i > 0; i--) {
    ta = n * (n - 1);
    ta = lcm(ta, i);
    ans = max(ans, ta);
  }
  cout << ans << endl;
}
