#include <bits/stdc++.h>
using namespace std;
const int size = 1e5 + 7;
const int mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  while (a && b) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
long long lcm(long long a, long long b) { return a * 1ll * (b / gcd(a, b)); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  if (n <= 2) {
    cout << n;
    return 0;
  }
  cout << max(lcm(n, lcm(n - 1, n - 2)),
              max(lcm(n, lcm(n - 1, n - 3)), lcm(n - 1, lcm(n - 2, n - 3))));
  return 0;
}
