#include <bits/stdc++.h>
using namespace std;
long long n, s, t, j;
long long gcd(long long a, long long b) {
  long long tmp;
  while (b != 0) {
    tmp = a % b;
    a = b;
    b = tmp;
  }
  return a;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  cin >> n;
  if (n == 1 || n == 2) {
    cout << n;
    return 0;
  }
  if (n % 2 == 1) {
    cout << lcm(lcm(n, n - 1), n - 2);
  } else {
    s = lcm(n, lcm(n - 1, n - 3));
    t = lcm(n - 1, lcm(n - 2, n - 3));
    cout << max(s, t);
  }
}
