#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int main() {
  long long int arr[100010] = {0};
  long long int m, n, q, ans = 0;
  scanf("%lld", &n);
  if (n == 1) return 0 * printf("%s\n", "1");
  if (n == 2) return 0 * printf("%s\n", "2");
  if (n % 2 == 0) {
    if (ans < n * (n - 1) * (n - 2) / 2) ans = n * (n - 1) * (n - 2) / 2;
    if (ans < (n - 1) * (n - 2) * (n - 3)) ans = (n - 1) * (n - 2) * (n - 3);
    if (n % 3 && ans < n * (n - 1) * (n - 3))
      ans = n * (n - 1) * (n - 3);
    else if (ans < n * (n - 1) * (n - 3) / 3)
      ans = n * (n - 1) * (n - 3) / 3;
    printf("%lld\n", ans);
  } else
    printf("%lld\n", n * (n - 1) * (n - 2));
  return 0;
}
