#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (a > 0 && b > 0) {
    if (a > b)
      a = a % b;
    else
      b = b % a;
  }
  if (a > 0) return a;
  if (b > 0) return b;
}
int main() {
  long long n;
  cin >> n;
  long long low = max(1LL, n - 5);
  long long ans = 0;
  for (long long i = low; i <= n; ++i)
    for (long long j = low; j <= n; ++j)
      for (long long k = low; k <= n; ++k) {
        long long lcm = i;
        lcm = lcm * j / gcd(lcm, j);
        lcm = lcm * k / gcd(lcm, k);
        ans = max(ans, lcm);
      }
  cout << ans;
  return 0;
}
