#include <bits/stdc++.h>
using namespace std;
long long n, m, m1, k, i, j, x, res, cur;
long long usg(long long x, long long y) {
  if (x == 0 || y == 0) {
    return x + y;
  }
  if (x < y) {
    return usg(y, x);
  }
  return usg(y, x % y);
}
int main() {
  cin >> n;
  if (n == 1) {
    res = 1;
  }
  if (n % 2 == 1) {
    res = n * (n - 1) * (n - 2);
  }
  if (n <= 200) {
    cur = 1;
  } else {
    cur = n - 200;
  }
  for (i = cur; i <= n; i++) {
    for (j = cur; j <= n; j++) {
      for (x = cur; x <= n; x++) {
        m = (i * j) / usg(i, j);
        m1 = (m * x) / usg(m, x);
        if (m1 > res) {
          res = m1;
        }
      }
    }
  }
  cout << res;
}
