#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (b > 0) {
    long long t = a;
    a = b;
    b = t % b;
  }
  return a;
}
int main() {
  long long n;
  cin >> n;
  if (n >= 5) {
    if (n % 2 == 1) {
      cout << n * (n - 1) * (n - 2) << "\n";
    } else {
      cout << max((n - 1) * (n - 2) * (n - 3),
                  n * (n - 1) * (n - 3) / gcd(n, n - 3))
           << "\n";
    }
  } else if (n == 4) {
    cout << "12\n";
  } else if (n == 3) {
    cout << "6\n";
  } else if (n == 2) {
    cout << "2\n";
  } else if (n == 1) {
    cout << "1\n";
  }
}
