#include <bits/stdc++.h>
unsigned long long gcd(unsigned long long a, unsigned long long b) {
  return (!b ? a : gcd(b, a % b));
}
unsigned long long gcd(unsigned long long a, unsigned long long b,
                       unsigned long long c) {
  return gcd(a, gcd(b, c));
}
unsigned long long nok(unsigned long long a, unsigned long long b) {
  return a * b / gcd(a, b);
}
unsigned long long nok(unsigned long long a, unsigned long long b,
                       unsigned long long c) {
  return nok(a, nok(b, c));
}
int main() {
  unsigned long long n;
  std::cin >> n;
  unsigned long long ma, mb, mc;
  if (n <= 20) {
    ma = 1;
    mb = 1;
    mc = 1;
  } else {
    ma = n - 20;
    mb = ma;
    mc = ma;
  }
  unsigned long long s = 0;
  for (unsigned long long a = ma; a <= n; ++a) {
    for (unsigned long long b = mb; b <= n; ++b) {
      for (unsigned long long c = mc; c <= n; ++c) {
        if (nok(a, b, c) > s) {
          s = nok(a, b, c);
        }
      }
    }
  }
  std::cout << s << std::endl;
}
