Some days ago, I learned the concept of LCM (least common multiple). I've played with it for several times and I want to make a big number with it.

But I also don't want to use many numbers, so I'll choose three positive integers (they don't have to be distinct) which are not greater than n. Can you help me to find the maximum possible least common multiple of these three integers?


-----Input-----

The first line contains an integer n (1 ≤ n ≤ 10^6) — the n mentioned in the statement.


-----Output-----

Print a single integer — the maximum possible LCM of three not necessarily distinct positive integers that are not greater than n.


-----Examples-----
Input
9

Output
504

Input
7

Output
210



-----Note-----

The least common multiple of some positive integers is the least positive integer which is multiple for each of them.

The result may become very large, 32-bit integer won't be enough. So using 64-bit integers is recommended.

For the last example, we can chose numbers 7, 6, 5 and the LCM of them is 7·6·5 = 210. It is the maximum value we can get.

Difficulty: MEDIUM_HARD

Solutions:
n = int(input())
if n < 3:
	print(n)
elif n % 2 == 0:
	if n % 3 == 0 and (n - 3) % 3 == 0:
		print((n - 1) * (n - 2) * (n - 3))
	else:
		print(n * (n - 1) * (n - 3))
else:
	print(n * (n - 1) * (n - 2))


n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n % 2 != 0:
	print(n * (n - 1) * (n - 2))
elif n % 6 == 0:
	print((n - 1) * (n - 2) * (n - 3))
else:
	print(n * (n - 1) * (n - 3))


from math import gcd

def solve(n):
	if n <= 2:
		return n
	if n & 1:
		return n * (n - 1) * (n - 2)
	ans = max(solve(n - 1), n * (n - 1) * (n - 2) // 2)
	for p in range(n - 3, 0, -2):
		if gcd(p, n) == 1 and gcd(p, n - 1) == 1:
			ans = max(ans, n * (n - 1) * p)
			break
	return ans
n = int(input())
print(solve(n))


import math
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
elif n % 2 != 0:
	print(n * (n - 1) * (n - 2))
elif math.gcd(n, n - 3) == 1:
	print(n * (n - 1) * (n - 3))
else:
	print((n - 1) * (n - 2) * (n - 3))


from collections import Counter
import string
import bisect
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def lcm(a, b):
	return a * b // math.gcd(a, b)
testcases = 1
for _ in range(testcases):
	n = vary(1)
	if n == 1:
		print(1)
	elif n == 2:
		print(2)
	elif n % 2 != 0:
		print(n * (n - 1) * (n - 2))
	else:
		maxi = -1
		for i in range(n, 2, -1):
			maxi = max(lcm(lcm(i, i - 1), i - 2), lcm(lcm(i, i - 1), i - 3), maxi)
		print(maxi)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a // gcd(a, b) * b
a = int(input())
if a == 1:
	print(1)
elif a == 2:
	print(2)
else:
	ans = 0
	who1 = 0
	who2 = 0
	who3 = 0
	for i in range(max(a - 55, 1), a + 1):
		for j in range(i, a + 1):
			for k in range(j, a + 1):
				ans = max(ans, lcm(lcm(i, j), k))
	print(ans)


import math as m

def lcm(a, b):
	return a * b // m.gcd(a, b)
n = int(input())
var = m.gcd(n, n - 1)
mx = 0
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
elif n == 4:
	print(12)
else:
	for i in range(0, min(50, n)):
		for j in range(0, min(50, n)):
			for k in range(0, min(50, n)):
				mx = max(mx, lcm(n - i, lcm(n - j, n - k)))
	print(mx)


a = int(input())
while True:
	if a == 1:
		print(1)
		break
	elif a == 2:
		print(2)
		break
	elif a == 3:
		print(6)
		break
	elif a == 4:
		print(12)
		break
	elif a % 2 != 0:
		print(a * (a - 1) * (a - 2))
		break
	elif a % 3 != 0:
		print(a * (a - 1) * (a - 3))
		break
	a -= 1


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass

def pmat(A):
	for ele in A:
		print(*ele, end='\n')
x = L()[0]
if x <= 2:
	print(x)
	exit()
if x % 2:
	n = x
	lcm = n * (n - 1) // gcd(n, n - 1)
	lcm = lcm * (n - 2) // gcd(lcm, n - 2)
	print(lcm)
else:
	ans = 1
	for n1 in range(max(1, x - 50), x + 1):
		for n2 in range(max(1, x - 50), x + 1):
			for n3 in range(max(1, x - 50), x + 1):
				lcm = n1 * n2 // gcd(n1, n2)
				lcm = lcm * n3 // gcd(lcm, n3)
				ans = max(ans, lcm)
	print(ans)
endtime = time.time()


n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
elif n == 4:
	print(12)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
elif n % 6 == 0:
	print(max(int(n * (n - 1) * (n - 2) / 2), (n - 1) * (n - 2) * (n - 3)))
else:
	print(max(int(n * (n - 1) * (n - 2) / 2), (n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3)))


import math

def main():
	n = int(input())
	if n <= 3:
		ans = 1
		for i in range(1, n + 1):
			ans *= i
		print(ans)
		return
	if n % 2 == 0:
		if n % 3 == 0:
			print((n - 3) * (n - 1) * (n - 2))
		else:
			print(n * (n - 1) * (n - 3))
	else:
		print(n * (n - 1) * (n - 2))
main()


import sys
import math as mt
input = sys.stdin.buffer.readline

def lcm(a, b):
	return a * b // mt.gcd(a, b)
t = 1
for __ in range(t):
	n = int(input())
	if n % 2 != 0:
		ans = n * (n - 1) * (n - 2)
	elif n % 3 == 0:
		ans = (n - 1) * (n - 2) * (n - 3)
	else:
		ans = n * (n - 1) * (n - 3)
	if n == 1:
		ans = 1
	if n == 2:
		ans = 2
	if n == 3:
		ans = 6
	print(ans)


from math import *
n = int(input())
if n == 3:
	print(6)
elif n == 2:
	print(2)
elif n == 1:
	print(1)
else:
	i = n - 1
	while True:
		i -= 1
		if gcd(n, i) == gcd(n - 1, i) == 1:
			break
	a = (n - 1) * (n - 2) * i
	for j in range(n, i + 1, -1):
		for k in range(j - 1, i, -1):
			for l in range(k - 1, i - 1, -1):
				b = j * k // gcd(j, k)
				b = b * l // gcd(b, l)
				a = max(a, b)
	print(a)


n = int(input())
if n <= 2:
	print(n)
	exit(0)
if n % 2 == 1:
	print(n * (n - 1) * (n - 2))
elif n % 3 != 0:
	print(n * (n - 1) * (n - 3))
else:
	n -= 1
	print(n * (n - 1) * (n - 2))


import sys
from math import log2, floor, ceil, sqrt, gcd
import bisect
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 1000000007
n = int(ri())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	lc = n * (n - 2) // 2
	if n % 3 != 0:
		print(max(lc * (n - 1), n * (n - 1) * (n - 3), (n - 3) * (n - 1) * (n - 2)))
	else:
		print(max(lc * (n - 1), (n - 3) * (n - 1) * (n - 2)))


n = int(input())
ans = 0
while n:
	if n == 1:
		ans = 1
	elif n == 2:
		ans = 2
	elif n == 3:
		ans = 6
	elif n % 2 == 0:
		if n % 3 == 0:
			ans = (n - 1) * (n - 2) * (n - 3)
		else:
			ans = n * (n - 1) * (n - 3)
	else:
		ans = n * (n - 1) * (n - 2)
	print(ans)
	break


def gcd(a, b):
	while a:
		b %= a
		(a, b) = (b, a)
	return b

def lcm(a, b):
	return a // gcd(a, b) * b
n = int(input())
ans = 0
for i in range(n, max(0, n - 100), -1):
	for j in range(i, max(0, i - 100), -1):
		cur = lcm(i, j)
		for k in range(j, max(0, j - 100), -1):
			ans = max(ans, lcm(cur, k))
print(ans)


n = int(input())
if n <= 6:
	if n == 1:
		print(1)
	elif n == 2:
		print(2)
	elif n == 3:
		print(6)
	elif n == 4:
		print(12)
	elif n == 5:
		print(60)
	elif n == 6:
		print(60)
elif n % 2 != 0:
	print(n * (n - 1) * (n - 2))
elif n % 2 == 0:
	if n % 3 == 0:
		print((n - 1) * (n - 2) * (n - 3))
	else:
		print((n - 1) * n * (n - 3))


n = int(input())
if n > 2:
	if n % 2:
		print(n * (n - 1) * (n - 2))
	elif n % 3:
		print(n * (n - 1) * (n - 3))
	else:
		print((n - 1) * (n - 2) * (n - 3))
else:
	print(n)


N = int(input())
if N >= 3:
	if N % 2 == 1:
		print(N * (N - 1) * (N - 2))
	elif N % 3 == 0:
		print((N - 1) * (N - 2) * (N - 3))
	else:
		print(N * (N - 1) * (N - 3))
elif N == 2:
	print('2')
else:
	print('1')


n = int(input())
if n < 3:
	print(n)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
elif n % 3 == 0:
	print(max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 5)))
else:
	print(n * (n - 1) * (n - 3))


from sys import stdin, stdout
import math
N = int(stdin.readline())
if N > 2:
	if N % 2 == 1:
		l = N * (N - 1) * (N - 2)
	elif N % 3 == 0:
		l = (N - 1) * (N - 2) * (N - 3)
	else:
		l = N * (N - 1) * (N - 3)
	stdout.write(str(l) + '\n')
elif N == 3:
	stdout.write('6\n')
elif N == 2:
	stdout.write('2\n')
elif N == 1:
	stdout.write('1\n')


import sys, os, io
import math, bisect, operator
(inf, mod) = (float('inf'), 10 ** 9 + 7)
from itertools import groupby, accumulate
from heapq import heapify, heappop, heappush
from collections import deque, Counter, defaultdict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
Neo = lambda : list(map(int, input().split()))
n = int(input())
if n <= 2:
	print(n)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
elif n % 3 == 0:
	print((n - 1) * (n - 2) * (n - 3))
else:
	print(n * (n - 1) * (n - 3))


n = int(input())
if n == 1:
	print(1)
	exit(0)
if n == 2:
	print(2)
	exit(0)
if n % 2:
	print(n * (n - 1) * (n - 2))
else:
	x = n * (n - 1) * (n - 2) // 2
	y = (n - 1) * (n - 2) * (n - 3)
	if n % 3:
		z = n * (n - 1) * (n - 3)
	else:
		z = n * (n - 1) * (n - 3) // 3
	print(max(x, y, z))


from math import gcd
from itertools import combinations
n = int(input())
if n <= 3:
	print((0, 1, 2, 6)[n])
else:
	m = 0
	for (i, j, k) in combinations(list(range(max(n - 50, 2), n + 1)), 3):
		r = i * j // gcd(i, j)
		m = max(m, r * k // gcd(r, k))
	print(m)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True

def lcm(a, b):
	return a * b // gcd(a, b)
n = iinp()
if n < 3:
	print(n)
elif n % 2:
	print(n * (n - 1) * (n - 2))
else:
	mx = 0
	for i in range(max(1, n - 11), n + 1):
		for j in range(max(1, n - 11), n + 1):
			for k in range(max(1, n - 11), n + 1):
				mx = max(lcm(lcm(i, j), k), mx)
	print(mx)


def read_string():
	return input()

def read_strings(return_type=iter, split=None, skip=0):
	return return_type(input().split(split)[skip:])

def read_lines(height, return_type=iter):
	return return_type((read_string() for i in range(height)))

def read_number():
	return int(input())

def read_numbers(return_type=iter, skip=0):
	return return_type((int(i) for i in input().split()[skip:]))

def read_values(*types, array=None):
	line = input().split()
	result = []
	for (return_type, i) in zip(types, range(len(types))):
		result.append(return_type(line[i]))
	if array != None:
		(array_type, array_contained) = array
		result.append(array_type((array_contained(i) for i in line[len(types):])))
	return result

def read_array(item_type=int, return_type=iter, skip=0):
	return return_type((item_type(i) for i in input().split()[skip:]))

def read_martix(height, **args):
	return_type = args['return_type'] if 'return_type' in args else iter
	return_type_inner = args['return_type_inner'] if 'return_type_inner' in args else return_type
	return_type_outer = args['return_type_outer'] if 'return_type_outer' in args else return_type
	item_type = args['item_type'] if 'item_type' in args else int
	return return_type_outer((read_array(item_type=item_type, return_type=return_type_inner) for i in range(height)))

def read_martix_linear(width, skip=0, item_type=int, skiped=None):
	num = read_array(item_type=item_type, skip=skip)
	height = len(num) / width
	return [num[i * width:(i + 1) * width] for i in range(height)]

def gcd(x, y):
	while x != 0:
		y %= x
		if y == 0:
			return x
		x %= y
	return y

def lcm(x, y):
	return x * y // gcd(x, y)

def main():
	n = read_number()
	r = range(max(1, n - 20), n + 1)
	print(max([lcm(lcm(x, y), z) for x in r for y in r for z in r]))
main()


from math import gcd
n = int(input())
if n <= 2:
	print(n)
elif not n % 6:
	print((n - 1) * (n - 2) * (n - 3))
elif not n % 2:
	print(n * (n - 1) * (n - 3))
else:
	print(n * (n - 1) * (n - 2))


import math
n = int(input())
if n <= 2:
	print(n)
	exit()
if n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	print(max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3) // math.gcd(n, n - 3)))


from sys import stdin, stdout

def solve(t):
	n = int(stdin.readline().strip())
	if n < 3:
		print(n)
		return
	if n % 2:
		print(n * (n - 1) * (n - 2))
	elif n % 3 == 0:
		print((n - 1) * (n - 2) * (n - 3))
	else:
		print(n * (n - 1) * (n - 3))
	pass
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
t = 1
while t <= tcs:
	solve(t)
	t += 1


from math import gcd
n = int(input())
mx = 1
for i in range(max(1, n - 20), n + 1):
	for j in range(max(1, n - 20), n + 1):
		for k in range(max(1, n - 20), n + 1):
			cur = i * j // gcd(i, j)
			cur = cur * k // gcd(cur, k)
			if mx < cur:
				mx = cur
print(mx)


import math

def check(n):
	if n == 1:
		return 1
	if n == 2:
		return 2
	if n == 3:
		return 6
	if n & 1:
		return (n - 1) * (n - 2) * n
	if math.gcd(n, n - 3) == 1:
		return n * (n - 1) * (n - 3)
	else:
		return (n - 1) * (n - 2) * (n - 3)
n = int(input())
print(check(n))


from math import gcd

def lcm(a, b):
	return a // gcd(a, b) * b
n = int(input())
res = 0
for i in range(max(1, n - 10), n + 1):
	for j in range(i, n + 1):
		for k in range(j, n + 1):
			res = max(res, lcm(lcm(i, j), k))
print(res)


import os
import sys
from math import gcd
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def solve():
	n = readint()
	if n == 1:
		print(1)
		return
	if n == 2:
		print(2)
		return
	if n == 3:
		print(6)
		return
	if n == 4:
		print(12)
		return
	findLCM = lambda arr: arr[0] * arr[1] // gcd(arr[0], arr[1]) * arr[2] // gcd(arr[2], arr[0] * arr[1] // gcd(arr[0], arr[1]))
	try1 = [n, n - 1, n - 2]
	try2 = [n, n - 1, n - 3]
	try3 = [n - 1, n - 2, n - 3]
	try4 = [n - 1, n - 2, n - 4]
	print(max(findLCM(try1), findLCM(try2), findLCM(try3), findLCM(try4)))

def main():
	t = 1
	for _ in range(t):
		solve()
main()


import math

def LCM(a, b):
	res = int(a * b / math.gcd(a, b))
	return res
a = int(input())
ans = 0
if a == 1:
	ans = 1
elif a == 2:
	ans = 2
elif a % 2 == 0:
	b1 = (a - 1) * (a - 2) * (a - 3)
	b2 = a * (a - 1) * (a - 3)
	if math.gcd(a, a - 3) > math.gcd(a, a - 2):
		ans = b1
	else:
		ans = b2
elif a % 2 == 1:
	ans = a * (a - 1) * (a - 2)
print(ans)


x = int(input())
if x == 1:
	print(1)
elif x == 2:
	print(2)
elif x % 2 == 1:
	print(x * (x - 1) * (x - 2))
elif x % 3 == 0:
	print((x - 3) * (x - 1) * (x - 2))
else:
	print(x * (x - 1) * (x - 3))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	if n < 3:
		print(n)
	elif n == 3:
		print(6)
	elif n & 1:
		print(n * (n - 1) * (n - 2))
	elif n % 3 == 0:
		print((n - 1) * (n - 2) * (n - 3))
	else:
		print(n * (n - 1) * (n - 3))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
input = lambda : sys.stdin.readline().rstrip('\r\n')

def print(*args, **kwargs):
	sep = kwargs.pop('sep', ' ')
	file = kwargs.pop('file', sys.stdout)
	atStart = True
	for x in args:
		if not atStart:
			file.write(sep)
		file.write(str(x))
		atStart = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
main()


from math import gcd
n = int(input())
if n <= 5:
	print([0, 1, 2, 6, 12, 60][n])
	exit()

def lcm(x, y):
	return x * y // gcd(x, y)
sol = 1
a = [n - i for i in range(5)]
for i in range(len(a)):
	for j in range(i):
		for k in range(j):
			sol = max(sol, lcm(lcm(a[i], a[j]), a[k]))
print(sol)


def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n % 2:
	print(n * (n - 1) * (n - 2))
else:
	max1 = (n - 1) * (n - 2) * (n - 3)
	for i in range(n - 1, max(n - 10, 1), -1):
		gcd1 = gcd(n, i)
		lcm1 = n * i // gcd1
		for j in range(n, max(n - 10, 0), -1):
			gcd2 = gcd(lcm1, j)
			max1 = max(max1, lcm1 * j // gcd2)
	print(int(max1))


import sys

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()

def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
if n == 1 or n == 2:
	print(n)
	exit()
if n & 1:
	print(lcm(lcm(n, n - 1), n - 2))
else:
	print(max(lcm(lcm(n - 1, n - 2), n - 3), lcm(n - 3, lcm(n, n - 1))))


import math

def answer(n):
	if n == 1:
		return 1
	elif n == 2:
		return 2
	if n % 2 != 0:
		return n * (n - 1) * (n - 2)
	elif n <= 6:
		return n * (n - 1) * (n - 2) // 2
	else:
		flag = 0
		if n % 3 == 0 or (n - 1) % 3 == 0:
			flag = 1
		x = (n - 1) * (n - 2) * (n - 3)
		for i in range(n - 3, 0, -1):
			if flag:
				if i % 3 != 0 and i % 2 != 0:
					return max(x, i * n * (n - 1))
			elif i % 2 != 0:
				return max(x, i * n * (n - 1))
n = int(input())
print(answer(n))


def MCD(a, b):
	if a % b == 0:
		return b
	else:
		return MCD(b, a % b)
x = int(input())
z = 1
salida = 0
salida2 = 0
a = x + 1
b = a - 1
c = b - 1
if x > 4:
	for k in range(3):
		a = a - 1
		b = a
		for l in range(3):
			b = b - 1
			c = b
			if b < 1:
				break
			for m in range(3):
				c = c - 1
				if c < 1:
					break
				if (MCD(a, b) == 1 and MCD(b, c) == 1 and (MCD(a, c) == 1)) and (a != 1 and b != 1 and (c != 1)):
					respuesta = a * b * c
					salida = 1
					salida2 = 1
					break
			if salida == 1:
				break
		if salida2 == 1:
			z = 2
			break
elif x == 4:
	respuesta = 12
elif x == 3:
	respuesta = 6
else:
	respuesta = x
print(respuesta)


def GCD(a, b):
	return a if b == 0 else GCD(b, a % b)

def LCM(a, b):
	return a // GCD(a, b) * b
n = int(input())
if n < 3:
	ans = n
elif n == 3:
	ans = 6
elif n % 2 == 0:
	if n % 3 == 0:
		ans = (n - 1) * (n - 2) * (n - 3)
	else:
		ans = n * (n - 1) * (n - 3)
else:
	ans = n * (n - 1) * (n - 2)
print(ans)


def gcd(a, b):
	r = a % b
	while r != 0:
		a = b
		b = r
		r = a % b
	return b

def ans(n):
	if n % 2 != 0:
		return n * (n - 1) * (n - 2)
	elif gcd(n, n - 3) == 1:
		return n * (n - 1) * (n - 3)
	else:
		return (n - 1) * (n - 2) * (n - 3)
n = int(input())
if n == 0:
	print(1)
elif n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	print(int(ans(n)))


def prime(x):
	a = []
	b = 1
	while b <= (x - 1) // 2:
		if x - x // (2 * b + 1) * (2 * b + 1) == 0:
			a.append(2 * b + 1)
			x = x // (2 * b + 1)
			b = 1
			continue
		else:
			b += 1
	return a

def sol():
	n = int(input())
	if n == 1:
		print(1)
	if n == 2:
		print(2)
	if n != 1 and n != 2:
		if n - n // 2 * 2 != 0:
			print(n * (n - 1) * (n - 2))
		else:
			k = 1
			while 3 <= 2 * k + 1 <= (n + 2) // 2:
				g = 0
				f = 0
				for x in prime(2 * k + 1):
					if n - n // x * x == 0:
						g = 1
						break
				if g == 1:
					k += 1
					continue
				for x in prime(2 * k):
					if n - 1 - (n - 1) // x * x == 0:
						f = 1
						break
				if f == 1:
					k += 1
					continue
				print(max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 2 * k - 1)))
				break
			if f == 1 or g == 1:
				print(max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 2) // 2))
sol()


n = int(input())
if n < 3:
	print(n)
	return
if n % 2 != 0:
	print(n * (n - 1) * (n - 2))
	return
if n % 3 == 0:
	print((n - 3) * (n - 1) * (n - 2))
	return
print((n - 1) * n * (n - 3))


n = int(input())
from sys import exit
if n < 3:
	print(n)
	exit(0)
if n % 2 != 0:
	print(n * (n - 1) * (n - 2))
	exit(0)
if n % 3 == 0:
	print((n - 3) * (n - 1) * (n - 2))
	exit(0)
print((n - 1) * n * (n - 3))


def main():
	n = int(input())
	print(n if n < 3 else (n - 1) * (n * (n - 2) if n & 1 else (n - 3) * (n if n % 3 else n - 2)))
main()


def gcd(a, b):
	c = a % b
	return gcd(b, c) if c else b
(s, a) = (0, int(input()))
if a < 3:
	print(a)
else:
	while a ** 3 > s:
		b = a - 1
		while a * b * b > s:
			if gcd(a, b) == 1:
				d = a * b
				c = b - 1
				while d * c > s:
					if gcd(c, d) == 1:
						s = d * c
					c -= 1
			b -= 1
		a -= 1
	print(s)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def YES(c):
	return IF(c, 'YES', 'NO')

def Yes(c):
	return IF(c, 'Yes', 'No')

def main():
	t = 1
	rr = []
	for _ in range(t):
		n = I()

		def f(a, b, c):
			t = a * b // math.gcd(a, b)
			return t * c // math.gcd(t, c)
		if n < 3:
			rr.append(n)
		else:
			r = n
			for a in itertools.combinations(range(max(1, n - 5), n + 1), 3):
				t = f(*a)
				if r < t:
					r = t
			rr.append(r)
	return JA(rr, '\n')
print(main())


import math
n = int(input())
s = 0
for i in range(n, max(0, n - 101), -1):
	for j in range(n, max(0, n - 101), -1):
		for k in range(n, max(0, n - 101), -1):
			l = i * j
			l //= math.gcd(i, j)
			e = math.gcd(l, k)
			l *= k // e
			s = max(s, l)
print(max(n, s))


import math
n = int(input())
m = 0
for i in range(min(100, n)):
	for ii in range(min(100, n)):
		for iii in range(min(100, n)):
			i1 = n - i
			ii1 = n - ii
			iii1 = n - iii
			r1 = i1 * ii1 // math.gcd(i1, ii1)
			r2 = r1 * iii1 // math.gcd(iii1, r1)
			m = max(m, r2)
print(m)


import math

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def main():
	n = int(input())
	if n <= 3:
		if n == 3:
			print(6)
		else:
			print(n)
	elif n % 2 == 1:
		print(n * (n - 1) * (n - 2))
	else:
		cr = (n - 1) * (n - 2) * (n - 3)
		for i in range(max(n - 50, 1), n + 1):
			for j in range(max(n - 50, 1), n + 1):
				for k in range(max(n - 50, 1), n + 1):
					lcm = i * j // gcd(i, j)
					lcm = lcm * k // gcd(lcm, k)
					if lcm > cr:
						cr = lcm
		print(cr)
main()


def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import math

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
n = ii()
if n == 1:
	print(1)
	exit()
if n == 2:
	print(2)
	exit()
if n % 6 == 0:
	print((n - 1) * (n - 2) * (n - 3))
	exit()
if n % 2:
	print(n * (n - 1) * (n - 2))
else:
	print(n * (n - 1) * (n - 3))


n = int(input())
if n < 3:
	print(n)
	exit(0)
if n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	g = 0
	if n % 3 == 0:
		g = n - 2
	else:
		g = n
	print((n - 1) * (n - 3) * g)


n = int(input())
if n <= 2:
	print(n)
elif n == 3:
	print(6)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	a = n * (n - 1) * (n - 3)
	if n % 3 == 0 and (n - 3) % 3 == 0:
		a /= 3
	b = (n - 1) * (n - 2) * (n - 3)
	print(max(a, b))


def NOD(a, b):
	while b != 0:
		a %= b
		y = a
		a = b
		b = y
	return a

def NOK(a, b):
	i = a * b // NOD(a, b)
	return i
n = int(input())
maxnok = 0
x = 40
for i in range(max(1, n - x), n + 1):
	for j in range(max(1, i - x), i + 1):
		for f in range(max(1, j - x), j + 1):
			nokk = NOK(NOK(i, j), f)
			if maxnok < nokk:
				maxnok = nokk
				delit = []
				delit.append(i)
				delit.append(j)
				delit.append(f)
print(maxnok)


def nok(n):
	if n < 3:
		return n
	if not n % 2 and n % 3:
		m = n * (n - 1) * (n - 3)
	else:
		m = 0
	n -= n % 2 == 0
	return max(n * (n - 1) * (n - 2), m)
print(nok(int(input())))


def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n % 2 == 1:
	print(lcm(n, lcm(n - 2, n - 1)))
else:
	ans = 0
	for i in range(max(n - 50, 1), n + 1):
		for j in range(max(n - 50, 1), n + 1):
			for k in range(max(n - 50, 1), n + 1):
				ans = max(ans, lcm(i, lcm(j, k)))
	print(ans)


n = int(input())

def gcd(a, b):
	if a == 0:
		return b
	else:
		return gcd(b % a, a)

def lcm(a, b):
	return a * b // gcd(a, b)
ret = 0
for a in range(max(n - 10, 1), n + 1):
	for b in range(a, n + 1):
		for c in range(b, n + 1):
			ret = max(ret, lcm(a, lcm(b, c)))
print(ret)


n = int(input())
if n == 1 or n == 2:
	print(n)
elif n % 6 == 0:
	exit(print(max(n * (n - 1) * (n - 3) // 3, (n - 1) * (n - 2) * (n - 3))))
elif n % 2 == 0:
	print(max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3)))
else:
	print(n * (n - 1) * (n - 2))


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
if n == 1 or n == 2:
	print(n)
	exit()
elif n & 1:
	print(n * (n - 1) * (n - 2))
elif n % 3 == 0:
	print((n - 1) * (n - 2) * (n - 3))
else:
	print(n * (n - 1) * (n - 3))


a = int(input())
if a <= 2:
	print(a)
elif a % 6 == 0:
	print((a - 1) * (a - 2) * (a - 3))
elif a % 2 == 0:
	print(a * (a - 1) * (a - 3))
else:
	print(a * (a - 1) * (a - 2))


n = int(input())
from math import gcd

def lcm(x, y):
	lcm = x * y // gcd(x, y)
	return lcm
prod1 = lcm(lcm(n, n - 1), n - 2)
prod2 = lcm(lcm(n - 1, n - 2), n - 3)
prod3 = lcm(lcm(n, n - 1), n - 3)
if n == 1 or n == 2:
	print(n)
else:
	print(max([prod1, prod2, prod3]))


n = int(input())
from math import *
if n == 3:
	print(6)
elif n == 2:
	print(2)
elif n == 1:
	print(1)
elif n % 2:
	print(n * (n - 1) * (n - 2))
else:
	n -= 1
	res = n * (n - 1) * (n - 2)
	for i in range(n - 2, 0, -2):
		if gcd(n + 1, i) == 1:
			res = max(res, (n + 1) * n * i)
			break
	print(res)


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b // gcd(a, b)

def main(n):
	mi = 0
	for i in range(max(1, n - 50), n + 1):
		for j in range(max(1, n - 50), n + 1):
			for k in range(max(1, n - 50), n + 1):
				mi = max(mi, lcm(lcm(i, j), k))
	return mi
print(main(int(input())))


import math
n = int(input())
if n <= 2:
	print(n)
	exit()
if n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	a = n * (n - 1) * (n - 3)
	b = (n - 3) * (n - 1) * (n - 2)
	if math.gcd(n, n - 3) == 1:
		print(a)
	else:
		print(b)


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]

def LCM(a, b):
	return a * b // gcd(a, b)
n = Int()
if n <= 2:
	print(n)
else:
	ans1 = LCM(n * (n - 1), n - 2)
	ans2 = LCM(n * (n - 1), n - 3)
	n -= 1
	ans3 = LCM(n * (n - 1), n - 2)
	ans4 = LCM(n * (n - 1), n - 3)
	print(max(ans1, ans2, ans3, ans4))


n = int(input())
if n <= 2:
	print(n)
elif n % 2 != 0:
	print(n * (n - 1) * (n - 2))
elif n % 3 != 0:
	print(n * (n - 1) * (n - 3))
elif n % 2 == 0:
	print((n - 1) * (n - 2) * (n - 3))


def lcm(a, b, c):
	m = a * b
	while a != 0 and b != 0:
		if a > b:
			a %= b
		else:
			b %= a
	b = m // (a + b)
	m = b * c
	while c != 0 and b != 0:
		if c > b:
			c %= b
		else:
			b %= c
	return m // (c + b)
n = int(input())
if n == 1:
	ans = 1
elif n == 2:
	ans = 2
else:
	ans = max(lcm(n - 1, n, n - 3), lcm(n, n - 1, n - 2), lcm(n - 1, n - 2, n - 3), lcm(n, n - 2, n - 3), lcm(n, n - 1, n - 4), lcm(n, n - 1, n - 5))
print(ans)


import time, math as mt, bisect, sys
sys.setrecursionlimit(100000)
from sys import stdin, stdout
from collections import defaultdict
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	n = II()
	if n == 1:
		P(1)
		return
	if n == 2:
		P(2)
		return
	if n % 2 != 0:
		print(n * (n - 1) * (n - 2))
		return
	else:
		if n % 3 == 0:
			print((n - 1) * (n - 2) * (n - 3))
			return
		else:
			print(n * (n - 1) * (n - 3))
		return
t = 1
for i in range(t):
	solve()


from math import gcd
n = int(input())
if n <= 5:
	print([0, 1, 2, 6, 12, 60][n])
	exit()
sol = 1
a = [n, n - 1, n - 2, n - 3, n - 4]
for i in range(5):
	for j in range(i):
		for k in range(j):
			sol = max(sol, a[i] * a[j] * a[k] // gcd(a[i], a[k]))
print(sol)


import sys
n = int(input())
if n <= 2:
	print(n)
	sys.exit()
if n % 2 == 1:
	print(n * (n - 1) * (n - 2))
	sys.exit()
if n % 3 > 0:
	if n * (n - 1) * (n - 2) / 2 > n * (n - 1) * (n - 3):
		print(n * (n - 1) * (n - 2) / 2)
	else:
		print(n * (n - 1) * (n - 3))
	sys.exit()
a = n * (n - 1) * (n - 2) / 2
b = (n - 1) * (n - 2) * (n - 3)
c = n * (n - 2) * (n - 3) / 3
if a >= b and a >= c:
	print(int(a))
elif b >= c:
	print(int(b))
else:
	print(int(c))


from sys import stdin
input = lambda : stdin.readline().strip()
from math import ceil, sqrt, factorial
from collections import deque

def gcd(a, b):
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
n = int(input())
if n <= 2:
	print(n)
elif n % 2 != 0:
	print(n * (n - 1) * (n - 2))
else:
	t = n * (n - 1)
	ma = t
	for i in range(1, n - 1):
		ma = max(ma, t * i // gcd(t, i))
	print(max(ma, (n - 1) * (n - 2) * (n - 3)))


import math

def lcm(x, y):
	return x * (y // math.gcd(x, y))
n = int(input())
if n < 3:
	print(n)
elif n == 3:
	print(6)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	ans = 0
	for i in range(max(n - 50, 1), n - 1):
		for j in range(i + 1, n):
			for k in range(j + 1, n + 1):
				ans = max(ans, lcm(i, lcm(j, k)))
	print(ans)


from math import *

def lcm(a, b, c):
	tmp = a * b // gcd(a, b)
	return tmp * c // gcd(tmp, c)
n = int(input())
if n < 3:
	print(n)
else:
	a = lcm(n, n - 1, n - 2)
	b = lcm(n - 3, n - 1, n - 2)
	c = lcm(n, n - 1, n - 3)
	d = lcm(n, n - 2, n - 3)
	print(max(n, max(max(a, b), max(c, d))))


def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
c = int(input())
if c == 1 or c == 2:
	print(c)
else:
	i = c - 2
	maxi = 0
	while i >= max(0, c - 1000):
		k = c * (c - 1) * i // gcd(c * (c - 1), i)
		if k > maxi:
			maxi = k
		i -= 1
	c -= 1
	i = c - 2
	maxi1 = 0
	while i >= max(0, c - 1000):
		k = c * (c - 1) * i // gcd(c * (c - 1), i)
		if k > maxi1:
			maxi1 = k
		i -= 1
	print(max(maxi, maxi1))


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(list(map(int, cin().split())))

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)
(n,) = mp()
if n < 3:
	cout(str(n))
elif n % 2:
	y = n * (n - 1) * (n - 2)
	cout(str(y))
else:
	y = max(n * (n - 2) // 2, n * (n - 3) // gcd(n, n - 3))
	z = max(y * (n - 1), (n - 3) * (n - 1) * (n - 2))
	cout(str(z))


import math
n = int(input())
if n == 1:
	print(1)
elif n < 3:
	print(n * (n - 1))
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
elif math.gcd(n - 1, n - 3) == 1 and math.gcd(n - 3, n) == 1:
	(x, y) = (n * (n - 1) * (n - 3), (n - 1) * (n - 2) * (n - 3))
	print(max(x, y))
else:
	print((n - 1) * (n - 2) * (n - 3))


from collections import Counter, defaultdict, deque
import heapq as hq
import math
import sys
input = sys.stdin.readline
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
elif n % 2 == 0:
	if math.gcd(n, n - 3) == 1:
		print(max(n * (n - 1) * (n - 2) // 2, (n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3)))
	else:
		print(max(n * (n - 1) * (n - 2) // 2, (n - 1) * (n - 2) * (n - 3)))
else:
	print(n * (n - 1) * (n - 2))


n = int(input())
if n == 1:
	print(1)
if n == 2:
	print(2)
if n % 2 != 0 and n != 1:
	print(n * (n - 1) * (n - 2))
if n % 2 == 0 and n != 2 and (n % 3 == 0):
	print((n - 1) * (n - 2) * (n - 3))
if n % 2 == 0 and n != 2 and (n % 3 != 0):
	print(n * (n - 1) * (n - 3))


n = int(input().strip())
a = 1
if n > 2:
	if n % 2 == 1:
		a = n * (n - 1) * (n - 2)
	elif n % 3 != 0:
		a = n * (n - 1) * (n - 3)
	else:
		a = (n - 1) * (n - 2) * (n - 3)
else:
	a = n
print(a)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def main():
	mode = 'filee'
	if mode == 'file':
		f = open('test.txt', 'r')
	if mode == 'file':
		n = int(f.readline())
	else:
		n = int(input())
	if n == 1:
		print('1')
		return
	if n == 2:
		print('2')
		return
	if n == 3:
		print('6')
		return
	if n == 4:
		print('12')
		return
	i = n + 1
	[a, b, c] = [1, 1, 1]
	stop = 20
	while i >= n // 2 and i > n - stop:
		i -= 1
		j = n
		while j >= n // 2 - 1 and j > n - stop:
			j -= 1
			if i == j:
				continue
			k = n - 1
			while k >= n // 2 - 2 and k > n - stop:
				k -= 1
				if k == j:
					continue
				if gcd(i, j) == 1 and gcd(i, k) == 1 and (gcd(j, k) == 1):
					if i * j * k > a * b * c:
						[a, b, c] = [i, j, k]
	print(a * b * c)
	if mode == 'file':
		f.close()

def __starting_point():
	main()
__starting_point()


t = int(input())

def hcfnaive(a, b):
	if b == 0:
		return a
	else:
		return hcfnaive(b, a % b)
if t > 2:
	if t & 1:
		temp1 = t * (t - 1) * (t - 2)
		print(temp1)
	else:
		temp1 = (t - 1) * (t - 3) // hcfnaive(t - 1, t - 3)
		temp2 = temp1 * (t - 2) // hcfnaive(temp1, t - 2)
		temp3 = temp1 * t // hcfnaive(temp1, t)
		print(max(temp3, temp2))
else:
	print(t)


def lcm_challenge(a):
	if a <= 2:
		print(n)
	elif a % 6 == 0:
		print((a - 1) * (a - 2) * (a - 3))
	elif a % 2 == 0:
		print(a * (a - 1) * (a - 3))
	else:
		print(a * (a - 1) * (a - 2))
n = int(input())
lcm_challenge(n)


n = int(input())
if n == 1 or n == 2:
	print(n)
elif n % 2 != 0:
	print(int(n * (n - 1) * (n - 2)))
elif n % 3 == 0:
	print((n - 2) * (n - 1) * (n - 3))
else:
	print((n - 3) * (n - 1) * n)


from math import gcd

def lcm(a, b, c):
	ans = a
	ans = ans * b // gcd(ans, b)
	ans = ans * c // gcd(ans, c)
	return ans
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2 * 1)
elif n == 3:
	print(3 * 2 * 1)
elif n % 2:
	print(n * (n - 1) * (n - 2))
else:
	maxi = -1
	for i in range(n, n - 1000, -1):
		maxi = max(maxi, lcm(i, i - 1, i - 2))
		maxi = max(maxi, lcm(i, i - 1, i - 3))
	print(maxi)


n = int(input())
ans = 0
if n == 1:
	print(1)
	exit()
if n == 2:
	print(2)
	exit()
if n == 3:
	print(6)
	exit()
if n % 2 == 0:
	if n % 3 == 0:
		ans = (n - 1) * (n - 2) * (n - 3)
	else:
		ans = n * (n - 1) * (n - 3)
else:
	ans = n * (n - 1) * (n - 2)
print(ans)


def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
res = 0
for i in range(max(1, n - 50), n + 1):
	for j in range(max(1, n - 50), n + 1):
		if gcd(i, j) == 1:
			for k in range(max(1, n - 50), n + 1):
				if lcm(lcm(i, j), k) > res and i != j and (j != k) and (i != k):
					res = max(res, lcm(lcm(i, j), k))
if n == 1 or n == 2:
	print(n)
else:
	print(res)


from math import *
(n, ans) = (int(input()), 0)
if n < 3:
	ans = n
elif n % 2:
	ans = n * (n - 1) * (n - 2)
else:
	a = 0
	if gcd(n, n - 3) == 1:
		a = n * (n - 1) * (n - 3)
	n -= 1
	ans = max(n * (n - 1) * (n - 2), a)
print(ans)


from math import gcd
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	a1 = n
	a2 = n - 1
	a3 = n - 2
	lcm = a1 * a2 // gcd(a1, a2)
	lcm2 = a3 * a2 // gcd(a3, a2)
	ans = 1
	for i in range(n - 2, 0, -1):
		ans = max(ans, lcm * i // gcd(lcm, i))
		ans = max(ans, lcm2 * i // gcd(lcm2, i))
	print(ans)


from math import gcd

def lcm(a, b, c):
	g = gcd(a, b)
	ans = a * b // g
	g = gcd(ans, c)
	ans = ans * c // g
	return ans
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n % 2 == 0 and n % 3 == 0:
	print((n - 1) * (n - 2) * (n - 3))
elif n % 2 == 0:
	print((n - 1) * n * (n - 3))
else:
	print((n - 1) * (n - 2) * n)


def Solve(n):
	if n <= 2:
		return n
	elif n % 6 == 0:
		return (n - 1) * (n - 2) * (n - 3)
	elif n % 2 == 0:
		return n * (n - 1) * (n - 3)
	else:
		return n * (n - 1) * (n - 2)
n = int(input())
print(Solve(n))


import sys
import math

def isprime(n):
	if n == 1:
		return False
	if n == 2:
		return True
	if n == 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i ** 2 <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i += 6
	return True

def largest_prime(n):
	for i in range(n, 1, -1):
		if isprime(i):
			return i

def lcm(a, b):
	return a * b // math.gcd(a, b)

def answer(n):
	if n == 1:
		return 1
	if n == 2:
		return 2
	if n == 3:
		return 6
	if n == 4:
		return 12
	if n % 2 == 1:
		return n * (n - 1) * (n - 2)
	if n == 6:
		return 60
	return max((n - 1) * (n - 2) * (n - 3), lcm(n * (n - 1), n - 3))

def main():
	n = int(sys.stdin.readline())
	print(answer(n))
	return
main()


from itertools import combinations_with_replacement
I = lambda : int(input())
IL = lambda : list(map(int, input().split()))

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y, z):
	ans = x * y // gcd(x, y)
	ans = ans * z // gcd(ans, z)
	return ans
n = I()
print(max((lcm(*c) for c in combinations_with_replacement(range(max(1, n - 5), n + 1), 3))))


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
else:
	ans = 0
	for b1 in range(min(n, 100)):
		for b2 in range(min(n, 100)):
			for b3 in range(min(n, 100)):
				ans = max(ans, lcm(lcm(n - b1, n - b2), n - b3))
	print(ans)


import math

def check(b):
	for i in range(2, int(math.sqrt(b)) + 1):
		if b % i == 0:
			return 0
	return 1

def gcd(p, q):
	if q == 0:
		return p
	return gcd(q, p % q)
n = int(input())
if n <= 2:
	print(n)
else:
	a = n * (n - 1)
	ans1 = a * (n - 2) // gcd(a, n - 2)
	b = n * (n - 1)
	ans2 = 0
	for i in range(n - 2, max(0, n - 52), -1):
		if gcd(b, i) == 1:
			ans2 = b * i // gcd(b, i)
			break
	c = max(ans1, ans2)
	if n % 2 == 0:
		a = (n - 1) * (n - 2)
		temp = a * (n - 3) // gcd(a, n - 3)
		c = max(c, temp)
	print(c)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]

def lcm(a, b, c):
	l1 = a * b // gcd(a, b)
	return l1 * c // gcd(l1, c)
n = int(data())
if n <= 2:
	out(n)
	exit()
answer = 0
for i in range(n, max(0, n - 100), -1):
	for j in range(i - 1, max(0, n - 100), -1):
		for k in range(j - 1, max(0, n - 100), -1):
			answer = max(answer, lcm(i, j, k))
out(answer)


def gcd(a, b):
	while b > 0:
		temp = a % b
		a = b
		b = temp
	return a
from operator import itemgetter
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	num = [0] * 6
	temp = n * (n - 1)
	temp2 = (n - 1) * (n - 2)
	num[0] = temp * (n - 2) // gcd(temp, n - 2)
	num[1] = temp * (n - 3) // gcd(temp, n - 3)
	num[2] = temp * (n - 4) // gcd(temp, n - 4)
	num[3] = (n - 1) * (n - 2) * (n - 3)
	num[4] = temp * (n - 5) // gcd(temp, n - 5)
	num[5] = temp * (n - 6) // gcd(temp, n - 6)
	print(max(num))


from math import factorial, gcd
import itertools
n = int(input())
if n <= 3:
	print(factorial(n))
	exit()
ans = 0
for (a, b, c) in itertools.product(range(max(n - 50, 1), n + 1), range(max(n - 50, 1), n + 1), range(max(n - 50, 1), n + 1)):
	x = a * b // gcd(a, b)
	x = x * c // gcd(x, c)
	ans = max(x, ans)
print(ans)


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
r = range(max(1, n - 20), n + 1)
ans = []
for x in r:
	for y in r:
		for z in r:
			a = lcm(x, lcm(y, z))
			ans.append(a)
print(max(ans))


import sys
input = sys.stdin.readline
MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input().strip('\n'))
si = lambda : input().strip('\n')
dgl = lambda : list(map(int, input().strip('\n')))
f = lambda : map(int, input().strip('\n').split())
il = lambda : list(map(int, input().strip('\n').split()))
ls = lambda : list(input().strip('\n'))
let = 'abcdefghijklmnopqrstuvwxyz'
from math import gcd

def lcm(x, y, z):
	tem = x * y // gcd(x, y)
	return tem * z // gcd(tem, z)
lcms = [0, 1, 2, 6, 12, 60, 60]
n = ii()
if n < 7:
	print(lcms[n])
elif n & 1:
	print(n * (n - 1) * (n - 2))
else:
	print(max(lcm(n, n - 1, n - 2), lcm(n, n - 1, n - 3), lcm(n - 1, n - 2, n - 3)))


def gcd(x, y):
	while y != 0:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	_lcm = x * y / gcd(x, y)
	if int(_lcm) == _lcm:
		return int(_lcm)
	else:
		return 0

def BiggestLCM(n):
	_b = False
	k = n - 1
	LCM = n * k
	U = LCM
	i = n - 2
	while gcd(LCM, i) != 1 and i > 0:
		if lcm(LCM, i) > U:
			U = lcm(LCM, i)
		i -= 1
	a = 1
	if i > 0:
		a = LCM * i
	if a > U:
		return a
	return U
n = int(input())
if n > 2 and n % 2 == 0:
	print(max([BiggestLCM(n), BiggestLCM(n - 1)]))
else:
	print(BiggestLCM(n))


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	a = n
	b = n - 1
	ans = a * b
	if n == 1:
		print(1)
	elif n == 2:
		print(2)
	elif n == 3:
		print(6)
	elif n > 20:
		ans = 0
		for i in range(n - 20, n + 1):
			for j in range(n - 20, n + 1):
				for k in range(n - 20, n + 1):
					ans = max(ans, lcm(lcm(i, j), k))
		print(ans)
	else:
		ans = 0
		for i in range(1, n + 1):
			for j in range(1, n + 1):
				for k in range(1, n + 1):
					ans = max(ans, lcm(lcm(i, j), k))
		print(ans)
testcase(1)


def gcd(a, b):
	return a if b == 0 else gcd(b, a % b)

def lcm(a, b):
	return a // gcd(a, b) * b
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
else:
	ans = 0
	for x in range(max(1, n - 50), n + 1):
		for y in range(x + 1, n + 1):
			for z in range(y + 1, n + 1):
				ans = max(ans, lcm(x, lcm(y, z)))
	print(ans)


n = int(input())
a = [0, 1, 2, 6, 12]
b = (n - 1) * (n - 2) * (n - 3)
c = n * (n - 1) * (n - 3)
if n % 3 == 0:
	d = c // 3
if n <= 4:
	print(a[n])
elif n % 6 == 0:
	print(max(b, d))
elif n % 2 == 0:
	print(max(b, c))
else:
	print(n * (n - 1) * (n - 2))


while True:
	try:
		n = int(input())
	except:
		break
	if n == 2:
		print(2)
		continue
	if n == 1:
		print(1)
		continue
	if n % 2 != 0:
		print(n * (n - 1) * (n - 2))
	elif n % 3 == 0:
		print((n - 1) * (n - 2) * (n - 3))
	else:
		print(n * (n - 1) * (n - 3))


def gcd(x, y):
	if x:
		return gcd(y % x, x)
	return y

def lcm(x, y):
	return x * y // gcd(x, y)
n = int(input())
r = range(max(1, n - 20), n + 1)
print(max([lcm(lcm(x, y), z) for x in r for y in r for z in r]))


import math
from functools import reduce

def lcm(a, b):
	g = math.gcd(a, b)
	return a // g * b // g * g

def solve(n):
	return max(find_from_n(n), find_from_n(n - 1))

def find_from_n(n):
	if n == 0:
		return 1
	a = [n]
	for i in range(n - 1, 0, -1):
		if len(a) >= 3:
			break
		if all((math.gcd(i, x) == 1 for x in a)):
			a.append(i)
	if len(a) >= 3 and a[-1] == 1:
		a[-1] = a[1] - 1
	return reduce(lambda x, y: lcm(x, y), a, a[0])
n = int(input())
r = max(solve(n), solve(n - 1))
print(r)


import sys
sys.setrecursionlimit(10 ** 8)
try:
	FILE_POINTER = open('input.inpt')
	input = FILE_POINTER.readline
except:
	FILE_POINTER = None
	input = sys.stdin.readline
n = int(input())
if n < 3:
	print(n)
elif n == 3:
	print(6)
elif n % 2:
	print(n * (n - 1) * (n - 2))
elif n % 3 == 0:
	print((n - 1) * (n - 2) * (n - 3))
else:
	print(n * (n - 1) * (n - 3))
if FILE_POINTER:
	FILE_POINTER.close()


n = int(input())
if n > 4:
	pro = n * (n - 1)
	if n % 2 == 1:
		pro *= n - 2
		print(pro)
	else:
		if n % 3 == 0:
			pro *= n - 5
		else:
			pro *= n - 3
		pro2 = (n - 1) * (n - 2) * (n - 3)
		print(max(pro, pro2))
elif n == 4:
	print(12)
elif n == 3:
	print(6)
elif n == 2:
	print(2)
else:
	print(1)


def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return 0
	return 1
n = int(input())
if n < 3:
	print(n)
elif n % 2:
	print(n * (n - 1) * (n - 2))
elif n % 6 != 0:
	print(n * (n - 1) * (n - 3))
else:
	print((n - 1) * (n - 2) * (n - 3))


class LCM_Challange:

	def __init__(self, n):
		self.n = n

	def solve(self):
		if self.n < 3:
			return self.n
		if self.n % 6 == 0:
			return (self.n - 1) * (self.n - 2) * (self.n - 3)
		elif self.n % 2 == 0:
			return self.n * (self.n - 1) * (self.n - 3)
		else:
			return self.n * (self.n - 1) * (self.n - 2)
obj = LCM_Challange(int(input()))
print(obj.solve())


import sys
n = int(input())
if n == 1:
	print(1)
	sys.exit()
if n == 2:
	print(2)
	sys.exit()
if n == 3:
	print(6)
	sys.exit()
elif n % 2 != 0:
	print(n * (n - 1) * (n - 2))
elif n % 3 != 0:
	print(n * (n - 1) * (n - 3))
else:
	print((n - 1) * (n - 2) * (n - 3))


import math
n = int(input())

def lcm(a, b):
	return a * b // math.gcd(a, b)
if n >= 3:
	print(max(lcm(n - 2, lcm(n, n - 1)), lcm(n - 3, lcm(n - 2, n - 1)), lcm(n - 3, lcm(n, n - 1))))
else:
	print(n)


import math
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
elif n % 2 != 0:
	print(n * (n - 1) * (n - 2))
else:
	a = n * (n - 1) // math.gcd(n, n - 1)
	a = a * (n - 3) // math.gcd(a, n - 3)
	b = (n - 1) * (n - 2) // math.gcd(n - 1, n - 2)
	b = (n - 3) * b // math.gcd(b, n - 3)
	print(max(a, b))


from math import gcd
x = int(input())
if x < 3:
	print(x)
elif x == 6:
	print(60)
elif x % 2 == 0:
	a = x * (x - 1) * (x - 3) // gcd(x, x - 3)
	b = (x - 1) * (x - 2) * (x - 3)
	print(max(a, b))
else:
	print(x * (x - 1) * (x - 2))


n = int(input())
arr = [1, 2, 6, 12, 60, 60, 210]
if n <= 7:
	print(arr[n - 1])
	exit(0)
if n % 2:
	print(n * (n - 1) * (n - 2))
else:
	result = n * (n - 1) * (n - 3)
	if sum(list(map(int, list(str(n))))) % 3 == 0 and sum(list(map(int, list(str(n - 3))))) % 3 == 0:
		result1 = n * (n - 1) * (n - 5)
		result2 = (n - 1) * (n - 2) * (n - 3)
		result = max(result1, result2)
	print(result)


n = int(input())
if n == 1 or n == 2:
	print(n)
elif n & 1:
	print(n * (n - 1) * (n - 2))
else:
	import math
	m = (n - 1) * (n - 2) * (n - 3)
	for i in range(1, n - 2, 2):
		m = max(m, n * (n - 1) * i // math.gcd(n, i))
	print(m)


import math as mt
import sys

def lcm(a, b):
	return a * b // mt.gcd(a, b)
n = int(input())
if n == 1:
	print(1)
	sys.exit()
elif n == 2:
	print(2)
	sys.exit()
st = max(1, n - 50)
ans = 0
for i in range(st, n + 1):
	for j in range(i + 1, n + 1):
		for k in range(j + 1, n + 1):
			ans = max(ans, lcm(k, lcm(i, j)))
print(ans)


def main():
	t = int(input())
	s = 1
	if t % 2 == 1:
		s = t * (t - 1) * (t - 2)
	elif t % 2 == 0 and t % 3 == 0:
		s = (t - 1) * (t - 2) * (t - 3)
	else:
		s = max(t * (t - 1) * (t - 3), t * (t - 1) * (t - 2) // 2)
	if t == 1 or t == 2:
		s = t
	print(s)
main()


import sys
from math import gcd, sqrt, ceil, log2
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
import math
sys.setrecursionlimit(2 * 10 ** 5 + 10)
import heapq
from itertools import permutations
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_sum(bit, i):
	s = 0
	i += 1
	while i > 0:
		s += bit[i]
		i -= i & -i
	return s

def update(bit, n, i, v):
	i += 1
	while i <= n:
		bit[i] += v
		i += i & -i

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def primeFactors(n):
	sa = set()
	sa.add(n)
	while n % 2 == 0:
		sa.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			sa.add(i)
			n = n // i
	return sa

def seive(n):
	pri = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if pri[p] == True:
			for i in range(p * p, n + 1, p):
				pri[i] = False
		p += 1
	return pri

def check_prim(n):
	if n < 0:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def getZarr(string, z):
	n = len(string)
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and string[r - l] == string[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and string[r - l] == string[r]:
					r += 1
				z[i] = r - l
				r -= 1

def search(text, pattern):
	concat = pattern + '$' + text
	l = len(concat)
	z = [0] * l
	getZarr(concat, z)
	ha = []
	for i in range(l):
		if z[i] == len(pattern):
			ha.append(i - len(pattern) - 1)
	return ha

def mergeIntervals(arr):
	arr.sort(key=lambda x: x[0])
	m = []
	s = -10000
	max = -100000
	for i in range(len(arr)):
		a = arr[i]
		if a[0] > max:
			if i != 0:
				m.append([s, max])
			max = a[1]
			s = a[0]
		elif a[1] >= max:
			max = a[1]
	if max != -100000 and [s, max] not in m:
		m.append([s, max])
	return m

class SortedList:

	def __init__(self, iterable=[], _load=200):
		values = sorted(iterable)
		self._len = _len = len(values)
		self._load = _load
		self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
		self._list_lens = [len(_list) for _list in _lists]
		self._mins = [_list[0] for _list in _lists]
		self._fen_tree = []
		self._rebuild = True

	def _fen_build(self):
		self._fen_tree[:] = self._list_lens
		_fen_tree = self._fen_tree
		for i in range(len(_fen_tree)):
			if i | i + 1 < len(_fen_tree):
				_fen_tree[i | i + 1] += _fen_tree[i]
		self._rebuild = False

	def _fen_update(self, index, value):
		if not self._rebuild:
			_fen_tree = self._fen_tree
			while index < len(_fen_tree):
				_fen_tree[index] += value
				index |= index + 1

	def _fen_query(self, end):
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		x = 0
		while end:
			x += _fen_tree[end - 1]
			end &= end - 1
		return x

	def _fen_findkth(self, k):
		_list_lens = self._list_lens
		if k < _list_lens[0]:
			return (0, k)
		if k >= self._len - _list_lens[-1]:
			return (len(_list_lens) - 1, k + _list_lens[-1] - self._len)
		if self._rebuild:
			self._fen_build()
		_fen_tree = self._fen_tree
		idx = -1
		for d in reversed(range(len(_fen_tree).bit_length())):
			right_idx = idx + (1 << d)
			if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
				idx = right_idx
				k -= _fen_tree[idx]
		return (idx + 1, k)

	def _delete(self, pos, idx):
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len -= 1
		self._fen_update(pos, -1)
		del _lists[pos][idx]
		_list_lens[pos] -= 1
		if _list_lens[pos]:
			_mins[pos] = _lists[pos][0]
		else:
			del _lists[pos]
			del _list_lens[pos]
			del _mins[pos]
			self._rebuild = True

	def _loc_left(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(lo, pos) = (-1, len(_lists) - 1)
		while lo + 1 < pos:
			mi = lo + pos >> 1
			if value <= _mins[mi]:
				pos = mi
			else:
				lo = mi
		if pos and value <= _lists[pos - 1][-1]:
			pos -= 1
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value <= _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def _loc_right(self, value):
		if not self._len:
			return (0, 0)
		_lists = self._lists
		_mins = self._mins
		(pos, hi) = (0, len(_lists))
		while pos + 1 < hi:
			mi = pos + hi >> 1
			if value < _mins[mi]:
				hi = mi
			else:
				pos = mi
		_list = _lists[pos]
		(lo, idx) = (-1, len(_list))
		while lo + 1 < idx:
			mi = lo + idx >> 1
			if value < _list[mi]:
				idx = mi
			else:
				lo = mi
		return (pos, idx)

	def add(self, value):
		_load = self._load
		_lists = self._lists
		_mins = self._mins
		_list_lens = self._list_lens
		self._len += 1
		if _lists:
			(pos, idx) = self._loc_right(value)
			self._fen_update(pos, 1)
			_list = _lists[pos]
			_list.insert(idx, value)
			_list_lens[pos] += 1
			_mins[pos] = _list[0]
			if _load + _load < len(_list):
				_lists.insert(pos + 1, _list[_load:])
				_list_lens.insert(pos + 1, len(_list) - _load)
				_mins.insert(pos + 1, _list[_load])
				_list_lens[pos] = _load
				del _list[_load:]
				self._rebuild = True
		else:
			_lists.append([value])
			_mins.append(value)
			_list_lens.append(1)
			self._rebuild = True

	def discard(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_right(value)
			if idx and _lists[pos][idx - 1] == value:
				self._delete(pos, idx - 1)

	def remove(self, value):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		value = self._lists[pos][idx]
		self._delete(pos, idx)
		return value

	def bisect_left(self, value):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_lists = self._lists
		if _lists:
			(pos, idx) = self._loc_left(value)
			return idx < len(_lists[pos]) and _lists[pos][idx] == value
		return False

	def __iter__(self):
		return (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def sol(n):
	seti = set()
	for i in range(1, int(sqrt(n)) + 1):
		if n % i == 0:
			seti.add(n // i)
			seti.add(i)
	return seti

def lcm(a, b):
	return a * b // gcd(a, b)

def debug(n):
	ans = 0
	(a, b, c) = (-1, -1, -1)
	for i in range(1, n + 1):
		for j in range(1, n + 1):
			for k in range(1, n + 1):
				k1 = lcm(i, j)
				k2 = lcm(k1, k)
				ans = max(k2, ans)
				if ans == k2:
					(a, b, c) = (i, j, k)
	print(a, b, c)
	return ans
n = int(input())
if n == 1:
	print(1)
	exit()
elif n == 2:
	print(2)
	exit()
elif n == 3:
	print(6)
	exit()
elif n == 4:
	print(12)
	exit()
if check_prim(n):
	print(n * (n - 1) * (n - 2))
	exit()
ans = 0
for i in range(n, n - 8, -1):
	for j in range(n, n - 8, -1):
		for k in range(n, n - 8, -1):
			if i != 0 and j != 0 and (k != 0):
				k1 = lcm(i, j)
				k2 = lcm(k1, k)
				ans = max(k2, ans)
				if ans == k2:
					(a, b, c) = (i, j, k)
print(ans)


from sys import stdin
import math
from collections import defaultdict, deque

def LCM(a, b):
	return a * b // math.gcd(a, b)
n = int(stdin.readline().strip())
if n == 1 or n == 2:
	print(n)
	exit()
elif n == 3:
	print(6)
if n > 3:
	if n % 2 == 0:
		if n % 3 == 0:
			print((n - 1) * (n - 2) * (n - 3))
		else:
			print(n * (n - 1) * (n - 3))
	else:
		print(n * (n - 1) * (n - 2))


import sys, math
input = sys.stdin.readline

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
import collections as col
import math

def solve():
	N = getInt()
	if N == 1:
		return 1
	if N == 2:
		return 2
	if N % 2 == 1:
		return N * (N - 1) * (N - 2)
	return max(N * (N - 1) * (N - 2) // 2, (N - 1) * (N - 2) * (N - 3), N * (N - 1) * (N - 3) if N % 3 > 0 else 0)
print(solve())


import sys
import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True
n = ii()
if n < 3:
	print(n)
elif n == 4:
	print(12)
elif n % 2 == 0 and n % 3 == 0:
	print((n - 1) * (n - 2) * (n - 3))
elif n % 2 == 0 and n % 3 != 0:
	print(n * (n - 1) * (n - 3))
else:
	print(n * (n - 1) * (n - 2))


from math import gcd

def lcm(a, b):
	return a * b // gcd(a, b)
n = int(input())
if n <= 2:
	print(n)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	ans = (n - 3) * (n - 1) * (n - 2)
	for k in range(1, n - 1):
		ans = max(ans, lcm(n * (n - 1), k))
	print(ans)


N = int(input())
import math

def union_lcm(lists):
	if len(lists) == 1:
		return lists[0]
	elif len(lists) > 1:
		num = lists[0]
		for i in range(1, len(lists)):
			num = num * lists[i] // math.gcd(num, lists[i])
		return num
if N > 3:
	if N % 2 != 0:
		print(max(N, 1) * max(1, N - 1) * max(1, N - 2))
	else:
		ans = 0
		for i in range(max(1, N - 50), N + 1):
			for j in range(max(1, N - 50), N + 1):
				for k in range(max(1, N - 50), N + 1):
					ans = max(ans, union_lcm([i, j, k]))
		print(ans)
if N == 3:
	print(6)
if N == 2:
	print(2)
if N == 1:
	print(1)


n = int(input())
if n == 1 or n == 2:
	print(n)
	exit()
if n % 2:
	print(n * (n - 1) * (n - 2))
	exit()
if n % 3:
	print(n * (n - 1) * (n - 3))
	exit()
print((n - 1) * (n - 2) * (n - 3))


import math

def lcm(a, b):
	return a * b // math.gcd(a, b)
a = int(input())
if a == 1:
	print(1)
	exit()
if a == 2:
	print(2)
	exit()
if a == 3:
	print(6)
	exit()
if a % 2 == 1:
	print(a * (a - 1) * (a - 2))
	exit()
else:
	n = a
	r = lcm(lcm(n, n - 1), n - 2)
	m = lcm(lcm(n - 1, n - 2), n - 3)
	x = lcm(lcm(n, n - 1), n - 3)
	print(max(r, m, x))


n = int(input())

def gcd(a, b):
	if a > b:
		return gcd(b, a)
	if a == 0:
		return b
	else:
		return gcd(b % a, a)

def lcm(a, b):
	return a * b // gcd(a, b)
mn = max(n - 10, 1)
ans = 1
for i in range(n, mn, -1):
	for j in range(i, mn, -1):
		for k in range(j, mn, -1):
			cur = lcm(lcm(i, j), k)
			if cur > ans:
				ans = cur
print(ans)


from math import gcd

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return input()
mod = 1000000000.0 + 7
n = ii()
if n % 2:
	x = n
	y = n - 2
	if y <= 0:
		y = 1
	x = x * y // gcd(x, y)
	ans = x
	for i in range(n - 1, 0, -1):
		if i == n - 2:
			continue
		if x * i <= ans:
			break
		s = x * i // gcd(x, i)
		ans = max(ans, s)
else:
	x = n
	y = n - 1
	if y <= 0:
		y = 1
	x = x * y // gcd(x, y)
	ans1 = x
	for i in range(n - 1, 0, -1):
		if i == n - 1:
			continue
		if x * i <= ans1:
			break
		s = x * i // gcd(x, i)
		ans1 = max(ans1, s)
	x = n - 1
	y = n - 2
	if y <= 0:
		y = 1
	x = x * y // gcd(x, y)
	ans2 = x
	for i in range(n - 1, 0, -1):
		if i == n - 2:
			continue
		if x * i <= ans1:
			break
		s = x * i // gcd(x, i)
		ans2 = max(ans2, s)
	ans = max(ans1, ans2)
print(ans)


import math as m

def lcm(a, b):
	return a * b // m.gcd(a, b)
n = int(input())
var = m.gcd(n, n - 1)
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
elif n == 4:
	print(12)
else:
	print(max(lcm(n, lcm(n - 1, n - 2)), lcm(n - 3, lcm(n - 1, n - 2)), lcm(n, lcm(n - 1, n - 3))))


import random, math
from copy import deepcopy as dc

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def solution(n):
	if n <= 2:
		return n
	a = dc(n)
	if n % 2 != 0:
		b = dc(n - 1)
		c = dc(n - 2)
	elif gcd(n, n - 3) == 1:
		b = n - 1
		c = n - 3
	else:
		a = n - 1
		b = n - 2
		c = n - 3
	l = lcm(lcm(a, b), c)
	return l

def input_test():
	n = int(input())
	out = solution(n)
	print(out)

def test():
	pass
input_test()


def solve(n):
	if n == 1:
		print('1')
	elif n == 2:
		print('2')
	elif n == 3:
		print('6')
	elif n & 1:
		print(n * (n - 1) * (n - 2))
	elif n % 3 == 0:
		print((n - 1) * (n - 2) * (n - 3))
	else:
		print(n * (n - 1) * (n - 3))
	return

def main():
	n = int(input())
	solve(n)
main()


import math

def LCM(x, y):
	return x * y // math.gcd(x, y)
n = int(input())
if n <= 2:
	print(n)
	exit()
res = 0
for i in range(n, 1, -1):
	if i % 2 == 0:
		res = max(res, LCM(LCM(i, i - 1), i - 2 - 1))
	else:
		res = max(res, LCM(LCM(i, i - 1), i - 2))
print(res)


import math as m
n = int(input())
if n < 3:
	print(n)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	a = n * (n - 1) * (n - 2) // m.gcd(n, n - 2)
	b = n * (n - 1) * (n - 3) // m.gcd(n, n - 3)
	c = (n - 1) * (n - 2) * (n - 3)
	print(max((a, b, c)))


from math import gcd
n = int(input())
if n == 1:
	print(1)
elif n == 2:
	print(2)
elif n == 3:
	print(6)
elif n == 4:
	print(12)
elif n % 2 == 1:
	print(n * (n - 1) * (n - 2))
else:
	ans = (n - 2) * (n - 1) * (n - 3)
	j = n - 3
	while j >= 1:
		if gcd(j, n) > 1:
			break
		ans = max(n * (n - 1) * j, ans)
		j -= 2
	print(ans)


import math

def answer(n):
	if n == 1:
		return 1
	elif n == 2:
		return 2
	if n % 2 != 0:
		return n * (n - 1) * (n - 2)
	elif n % 3 == 0:
		return (n - 1) * (n - 2) * (n - 3)
	else:
		return n * (n - 1) * (n - 3)
n = int(input())
print(answer(n))


def gcd(a, b):
	while b > 0:
		a %= b
		(a, b) = (b, a)
	return a

def lcm(a, b):
	return a // gcd(a, b) * b

def max_nok(n):
	if n % 2 == 1:
		return n * (n - 1) * (n - 2)
	else:
		x = lcm(n - 1, n - 2)
		y = lcm(x, n)
		return y
N = int(input())
if N == 1:
	print(1)
elif N == 2:
	print(2)
elif N == 3:
	print(6)
elif N == 4:
	print(12)
elif N == 5:
	print(60)
else:
	l = max(3, N - 100)
	r = N
	result = list()
	for a in range(l, r - 1):
		for b in range(a + 1, r):
			for c in range(b + 1, r + 1):
				x = lcm(a, b)
				y = lcm(x, c)
				result.append(y)
	print(int(max(result)))