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