#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x;
  cin >> x;
  if (x < 3)
    cout << x;
  else if (x % 2 != 0)
    cout << x * (x - 1) * (x - 2);
  else if (x % 2 == 0) {
    if ((x / 2) % 3 == 0)
      cout << (x - 3) * (x - 1) * (x - 2);
    else
      cout << x * (x - 3) * (x - 1);
  }
}
