#include <bits/stdc++.h>
using namespace std;
int main() {
  int_least64_t n;
  cin >> n;
  if (n == 4 || n == 8 || n == 16 || n == 32 || n == 64 || n == 128 ||
      n == 256 || n == 512 || n == 1024 || n == 2048 || n == 4096 ||
      n == 8192 || n == 16384 || n == 32768 || n == 65536 || n == 131072 ||
      n == 262144 || n == 524288 || n == 1048576)
    cout << n * (n - 1) * (n - 3);
  else if (n == 1)
    cout << "1";
  else if (n == 2)
    cout << 2;
  else if (n == 3)
    cout << "6";
  else if (n == 6)
    cout << "60";
  else {
    if (n % 2 == 0) {
      if (n % 3 == 0)
        cout << (n - 1) * (n - 2) * (n - 3);
      else
        cout << max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3));
    } else
      cout << n * (n - 1) * (n - 2);
  }
  return 0;
}
