#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int temp;
  long long int temp2;
  long long int temp3;
  temp3 = 0;
  if (n == 2)
    cout << "2" << endl;
  else if (n == 1)
    cout << "1" << endl;
  else if (n == 4)
    cout << "12" << endl;
  else if (n % 2 == 1) {
    temp = n * (n - 1) * (n - 2);
    cout << temp << endl;
  } else {
    if (n % 3 != 0) temp3 = n * (n - 1) * (n - 3);
    temp2 = (n - 1) * (n - 2) * (n - 3);
    temp = (n * (n - 1) * (n - 2)) / 2;
    long long int realtemp = max(temp2, temp);
    cout << max(realtemp, temp3) << endl;
  }
  return 0;
}
