#include <bits/stdc++.h>
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  unsigned long long r;
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }
  r = a % b;
  if (r == 0)
    return b;
  else
    return gcd(b, r);
}
int main() {
  unsigned long long n;
  unsigned long long max;
  unsigned long long i;
  while (scanf("%I64u", &n) != EOF) {
    if (n % 2 == 1) {
      if (n == 1)
        printf("1\n");
      else
        printf("%I64u\n", n * (n - 1) * (n - 2));
    } else {
      if (n == 2)
        printf("2\n");
      else {
        for (i = n - 2; gcd(i, n) != 1 || gcd(i, n - 1) != 1; i--)
          ;
        max = (n * (n - 1) * i);
        if (max < ((n - 1) * (n - 2) * (n - 3)))
          max = ((n - 1) * (n - 2) * (n - 3));
        printf("%I64u\n", max);
      }
    }
  }
  return 0;
}
