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