#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
inline long long int gcd(long long int ga, long long int gb) {
  if (!gb) return ga;
  return gcd(gb, ga % gb);
}
inline long long int lcm(long long int a, long long int b, long long int c) {
  long long int ans = a * b / gcd(a, b);
  return ans * c / gcd(ans, c);
}
int main() {
  long long int n;
  scanf("%lld", &n);
  if (n == 1)
    printf("1");
  else if (n == 2)
    printf("2");
  else if (n & 1)
    printf("%lld", n * (n - 1) * (n - 2));
  else {
    long long int ans(1);
    for (int i = 1; i <= n; ++i) ans = max(ans, lcm(n, n - 1, i));
    printf("%lld", max(ans, max((n - 1) * (n - 2) * (n - 3),
                                n * (n - 1) * (n - 2) / 2)));
  }
  return 0;
}
