#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a / gcd(a, b)) * b;
}
long long int LCM(long long int a, long long int b, long long int c) {
  return lcm(lcm(a, b), c);
}
int main() {
  ios ::sync_with_stdio(false);
  long long int n;
  cin >> n;
  if (n >= 4) {
    if (n % 2 == 1)
      cout << n * (n - 1) * (n - 2) << endl;
    else {
      long long int ans = (n - 1) * (n - 2) * (n - 3);
      int c;
      if (n >= 100)
        c = 50;
      else
        c = n / 2;
      for (long long int i = n; i >= n - c; i--) {
        for (long long int j = n; j >= n - c; j--) {
          for (long long int k = n; k >= n - c; k--) {
            ans = max(ans, LCM(i, j, k));
          }
        }
      }
      cout << ans << endl;
    }
  } else {
    if (n == 1)
      cout << 1 << endl;
    else if (n == 2)
      cout << 2 << endl;
    else
      cout << 6 << endl;
  }
  return 0;
}
