#include <bits/stdc++.h>
using namespace std;
const int MX = 223456;
long long N, q;
long long gcd(long long a, long long b) {
  while (a > 0 && b > 0) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  cin >> N;
  long long ans = 1;
  for (int a = max(1LL, N - 100); a <= N; a++) {
    for (int b = max(1LL, N - 100); b <= N; b++) {
      long long l = lcm(a, b);
      for (int c = max(1LL, N - 100); c <= N; c++) {
        ans = max(ans, lcm(l, c));
      }
    }
  }
  cout << ans;
  return 0;
}
