#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, ans = 0, pot;
  long long a, b, c, e;
  cin >> n;
  if (n <= 2) {
    cout << n;
    return 0;
  }
  for (long long i = n - 1e3; i <= n; i++) {
    a = i;
    b = i - 1;
    e = a * b;
    for (long long j = max(1LL, i - 50); j <= i - 2; j++) {
      c = j;
      pot = (e * c) / gcd(e, c);
      ans = max(ans, pot);
    }
  }
  cout << ans;
  return 0;
}
