#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e18, M = 1e9 + 7;
void solve() {
  long long int n;
  cin >> n;
  if (n <= 2) {
    cout << n;
    return;
  }
  if (n % 2)
    cout << n * (n - 1) * (n - 2);
  else {
    if (n % 3 == 0)
      cout << (n - 1) * (n - 2) * (n - 3);
    else
      cout << n * (n - 1) * (n - 3);
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
