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