#include <bits/stdc++.h>
using namespace std;
template <class T>
T min(T a, T b, T c) {
  return min(a, min(b, c));
}
template <class T>
T min(T a, T b, T c, T d) {
  return min(a, min(b, min(c, d)));
}
template <class T>
T max(T a, T b, T c) {
  return max(a, max(b, c));
}
template <class T>
T max(T a, T b, T c, T d) {
  return max(a, max(b, max(c, d)));
}
bool cmp(const int& a, const int& b) { return a > b; }
long long GCD(long long a, long long b) { return (a % b) ? GCD(b, a % b) : b; }
int main() {
  int n;
  scanf("%d", &n);
  if (n == 1) {
    puts("1");
    return 0;
  }
  if (n == 2) {
    puts("2");
    return 0;
  }
  long long ans = 0LL;
  long long _ans = (long long)n * (n - 1);
  for (int i = (1); i <= (n); ++i)
    ans = max(ans, ((_ans * i) / GCD(_ans, (long long)i)));
  _ans = (long long)(n - 1) * (n - 2);
  for (int i = (1); i <= (n); ++i)
    ans = max(ans, ((_ans * i) / GCD(_ans, (long long)i)));
  cout << ans << endl;
  return 0;
}
