#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e5 + 5;
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long cal(long long n) {
  long long ans = 0;
  if (gcd(n, n - 3) == 1) ans = max(ans, n * (n - 1) * (n - 3));
  ans = max(ans, (n - 1) * (n - 2) * (n - 3));
  return ans;
}
int main() {
  long long n;
  while (scanf("%lld", &n) != EOF) {
    if (n == 1)
      printf("1\n");
    else if (n == 2)
      printf("2\n");
    else if (n == 3)
      printf("6\n");
    else if (n == 4)
      printf("12\n");
    else if (n == 5)
      printf("60\n");
    else if (!(n % 2))
      printf("%lld\n", cal(n));
    else
      printf("%lld\n", n * (n - 1) * (n - 2));
  }
  return 0;
}
