#include <bits/stdc++.h>
const int factor_N = 10000005;
const int tree_arr_N = 1000005;
template <class T>
void chkmax(T& a, T b) {
  a > b ? (a = a) : (a = b);
}
template <class T>
void chkmin(T& a, T b) {
  a > b ? (a = b) : (a = a);
}
template <class T>
T min(T a, T b) {
  return a > b ? b : a;
}
template <class T>
T max(T a, T b) {
  return a < b ? b : a;
}
template <class T>
inline bool rd(T& ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return true;
}
template <class T>
inline void print(T x) {
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
  return;
}
using std::cin;
using std::cout;
using std::priority_queue;
using std::queue;
using std::set;
using std::stack;
using std::string;
using std::vector;
long long n, res;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  rd(n);
  if (n & 1)
    res = n * (n - 1) * (n - 2);
  else if (n == 2)
    res = n;
  else {
    if (gcd(n, n - 3) == 1)
      res = n * (n - 1) * (n - 3);
    else
      res = (n - 1) * (n - 2) * (n - 3);
  }
  if (n <= 2) res = n;
  print(res);
  puts("");
  rd(n);
  return 0;
}
