#include <bits/stdc++.h>
using namespace std;
long long res, N;
long long GCD(long long a, long long b) {
  while (b != 0) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
int main(void) {
  cin >> N;
  for (int i = N; i >= 1 && i >= N - 100; i--)
    for (int k = N; k >= 1 && k >= N - 100; k--)
      for (int z = N; z >= 1 && z >= N - 100; z--)
        res = max(res, LCM(LCM(i, k), z));
  cout << res;
  return 0;
}
