#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(int a, int b, int c) {
  long long x = (long long)a * (long long)b / (long long)gcd(a, b);
  long long res = (long long)c * x / (long long)gcd(c, x);
  return res;
}
int main() {
  int n;
  scanf("%i", &n);
  long long maxx = 1;
  for (int i = n; i > max(0, n - 75); i--) {
    for (int i2 = n; i2 > max(0, n - 75); i2--) {
      for (int i3 = n; i3 > max(0, n - 75); i3--) {
        maxx = max(maxx, lcm(i, i2, i3));
      }
    }
  }
  printf("%lld\n", maxx);
  return 0;
}
