#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  if (n == 1) {
    cout << '1' << '\n';
    return 0;
  } else if (n == 2) {
    cout << '2' << '\n';
    return 0;
  } else if (!(n % 2) && (n % 3)) {
    unsigned long long ans1 = (n * (n - 1) * (n - 2)) / 2;
    unsigned long long ans2 = (n - 1) * (n - 2) * (n - 3);
    unsigned long long ans3 = (n * (n - 1) * (n - 3));
    cout << max(max(ans1, ans2), ans3) << '\n';
  } else if (!(n % 2)) {
    unsigned long long ans1 = (n * (n - 1) * (n - 2)) / 2;
    unsigned long long ans2 = (n - 1) * (n - 2) * (n - 3);
    unsigned long long ans3 = (n * (n - 1) * (n - 3)) / 3;
    cout << max(max(ans1, ans2), ans3) << '\n';
  } else {
    unsigned long long ans = n * (n - 1) * (n - 2);
    cout << ans << '\n';
  }
}
