#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  if (n == 1) {
    std::cout << "1" << '\n';
    return 0;
  }
  if (n == 2) {
    std::cout << "2" << '\n';
    return 0;
  }
  long long int ans1;
  long long int ans2, ans3, ans4;
  long long int max1;
  if (n % 6 == 0) {
    ans1 = n * (n - 1) * (n - 2);
    ans1 /= 2;
    ans2 = n * (n - 1) * (n - 3);
    ans2 /= 3;
    ans3 = n * (n - 1) * (n - 5);
    ans4 = (n - 1) * (n - 2) * (n - 3);
    max1 = max({ans1, ans2, ans3, ans4});
    std::cout << max1 << '\n';
  } else if (n % 2 == 0) {
    ans1 = n * (n - 1) * (n - 2);
    ans2 = n * (n - 1) * (n - 3);
    ans1 /= 2;
    if (ans1 > ans2) {
      std::cout << ans1 << '\n';
    } else {
      std::cout << ans2 << '\n';
    }
  } else {
    ans1 = n * (n - 1) * (n - 2);
    std::cout << ans1 << '\n';
  }
  return 0;
}
