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