#include <bits/stdc++.h>
int main() {
  long long n;
  scanf("%lld", &n);
  if (n == 1)
    puts("1");
  else if (n == 2)
    puts("2");
  else if (n & 1)
    printf("%lld\n", n * (n - 1) * (n - 2));
  else if (n % 3 == 0)
    printf("%lld\n", (n - 1) * (n - 2) * (n - 3));
  else
    printf("%lld\n", n * (n - 1) * (n - 3));
  return 0;
}
