#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long c;
  while (a != 0) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long triple(long long x) {
  long long ans = x * max(1LL, x - 1LL) * max(1LL, x - 2LL);
  if (x % 2 == 0) {
    return x * max(1LL, x - 1LL) * max(1LL, x - 3LL);
  }
  if (x >= 4 && x % 2 == 0) {
    ans /= 2;
  }
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  int N;
  cin >> N;
  long long ans;
  switch (N) {
    case 1: {
      ans = 1;
      break;
    }
    case 2: {
      ans = 2;
      break;
    }
    default: {
      if (N % 2 != 0) {
        ans = N * (N - 1LL) * (N - 2LL);
      } else {
        ans = (N - 1LL) * (N - 2LL) * (N - 3LL);
        long long tmp = N * (N - 1LL);
        for (int i = N - 2; i >= 1; i--) {
          long long val = lcm(tmp, i);
          if (val > ans) {
            ans = val;
            break;
          }
        }
      }
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
