#include <bits/stdc++.h>
using namespace std;
const int MAX_INF = 0x7fffffff;
const int MIN_INF = 0xa0000000;
const int N = 1000009;
long long ans[N];
inline int gcd(int x, int y) {
  if (y == 0) return x;
  return gcd(y, x % y);
}
void init(void) {
  ans[1] = 1;
  ans[2] = 2;
  ans[3] = 6;
  long long tmp;
  long long lcm;
  for (int i = 4; i <= 1000000; i++) {
    if (i & 1) {
      ans[i] = i;
      ans[i] = ans[i] * (i - 1) * (i - 2);
      continue;
    }
    tmp = i;
    tmp = tmp * (i - 1);
    lcm = tmp * (i - 2);
    lcm /= 2;
    for (int k = i - 3; k >= 1; k -= 2) {
      if (tmp * k < lcm) break;
      if (gcd(k, i) == 1 && gcd(k, i - 1) == 1) {
        if (lcm < k * tmp) lcm = k * tmp;
        break;
      }
    }
    if (lcm < ans[i - 1])
      ans[i] = ans[i - 1];
    else
      ans[i] = lcm;
  }
}
int main() {
  int n;
  init();
  while (cin >> n) {
    cout << ans[n] << endl;
  }
  return 0;
}
