#include <bits/stdc++.h>
using namespace std;
long long n, ans;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
int main() {
  scanf("%I64d", &n);
  ans = 0;
  if (n == 1) {
    printf("1\n");
    return 0;
  } else if (n == 2) {
    printf("2\n");
    return 0;
  } else if (n == 3) {
    printf("6\n");
    return 0;
  } else if (n == 4) {
    printf("12\n");
    return 0;
  }
  for (int i = 0; i <= 1; ++i)
    for (int j = i + 1; j <= 2; ++j)
      for (int k = j + 1; k <= 3; ++k) {
        long long a = n - i, b = n - j, c = n - k;
        long long res = lcm(a, b);
        res = lcm(res, c);
        ans = max(ans, res);
      }
  printf("%I64d\n", ans);
}
