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