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