#include <bits/stdc++.h>
int main() {
  long long int n, i, s1, s2, s3;
  scanf("%lld", &n);
  if (n == 1) {
    printf("1\n");
  } else if (n == 2) {
    printf("2\n");
  } else if (n == 3) {
    printf("6\n");
  } else if (n == 4) {
    printf("12\n");
  } else if (n == 5 || n == 6) {
    printf("60\n");
  } else {
    if (n % 2 == 1) {
      printf("%lld\n", n * (n - 1) * (n - 2));
    } else {
      if (n % 3 != 0) {
        printf("%lld\n", (n - 1) * n * (n - 3));
      } else {
        printf("%lld\n", (n - 1) * (n - 2) * (n - 3));
      }
    }
  }
  return 0;
}
