#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000111;
const int MOD = 1000000007;
const int S_N = 201;
const int S_A = 1000010;
template <typename A, typename B>
ostream& operator<<(ostream& out, const pair<A, B>& p) {
  out << "(" << p.first << "," << p.second << ") ";
  return out;
}
template <typename A, typename B>
void printP(const pair<A, B>& p, const char* str = NULL) {
  if (str != NULL) cout << str << ":";
  cout << "(" << p.first << "," << p.second << ") ";
}
template <typename T>
void printV(const vector<T>& v, const char* str = NULL) {
  if (str != NULL) cout << str << ": ";
  for (int i = 0; i < (v.size()); ++i) cout << v[i] << " ";
  cout << '\n';
}
long long nwd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return nwd(b, a % b);
}
long long nww(long long a, long long b) {
  return (a / nwd(a, b)) * (long long)b;
}
void solve() {
  long long n;
  cin >> n;
  long long maxi = 0;
  if (n <= 100) {
    for (int a = 1; a <= (n); ++a)
      for (int b = 1; b <= (n); ++b)
        for (int c = 1; c <= (n); ++c) {
          maxi = max((nww(nww(a, b), c)), (maxi));
        }
  } else {
    for (int c = 1; c <= (n - 2); ++c) {
      maxi = max((nww(nww(n, n - 1), c)), (maxi));
      if (c < n - 2) maxi = max((nww(nww(n - 1, n - 2), c)), (maxi));
    }
  }
  cout << maxi << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  solve();
  return 0;
}
