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?

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

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

NoteThe 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.

{$apptype console}
{$b-}
uses math;
var
 k,n:integer;
 cur1,mx,cur:int64;

 Function gcd(a,b:int64):int64;
 begin
   if b=0 then gcd:=a else gcd:=gcd(b,a mod b);
 end;
begin
 {reset(input,'input.txt');
 rewrite(output,'output.txt'); }
 readln(n);
 if n=1 then write(1) else if n=2 then writeln(2)
                           else if n=3 then writeln(6) else
                                if n=4 then writeln(12) else if n mod 2=1 then writeln(int64(n)*int64(n-1)*int64(n-2))
                                else
                                begin
                                 if n mod 2=0 then mx:=int64(n-1)*int64(n-2)*int64(n-3) else mx:=-1;
                                       cur1:=int64(n)*int64(n-1);
                                       for k := 1 to n do
                                         begin
                                          cur:=cur1*k div gcd(cur1,k);
                                          if cur>mx then mx:=cur;

                                         end;
                                         writeln(mx)
                                end;
end.

program A146;
const
        inp='';
        oup='';
var
        N:longint;
        Res:QWord;
        i1,j1,k1:longint;
        i,j,k:Qword;
        Cres:QWord;

function UCLN(A,B:QWord):QWord;
begin
        if b=0 then exit(A);
        exit(UCLN(B, A mod B));
end;

begin
        readln(N);
        if N=1 then writeln(1);
        if N=2 then writeln(2);
        if n>=3 then
                begin
                        for i1:=N downto N-100 do
                                for j1:=i1-1 downto N-100 do
                                        for k1:=j1-1 downto N-100 do
                                                if (i1>0) and (j1>0) and (k1>0) then
                                                begin
                                                        i:=i1; j:=j1; k:=k1;
                                                        Cres:=(i*j) div UCLN(i,j);
                                                        Cres:=(Cres*k) div UCLN(Cres,k);
                                                        if Cres>Res then Res:=Cres;
                                                end;
                        writeln(Res);
                end;
end.

VAR
 a,n:int64;
 begin
  readln(n);
  if n=1 then
   begin
    writeln('1');
    exit;
  end;
 if n=2 then
  begin
   writeln('2');
   exit;
  end;
 if n mod 2=1 then a:=n*(n-1)*(n-2)
 else if n mod 3=0 then a:=(n-1)*(n-2)*(n-3)
 else a:=n*(n-1)*(n-3);
 writeln(a);
end.

{$R+,Q+,I+}
{$apptype console}
Uses SysUtils;
Var
   n,ans,r1,r2:Int64;
   i,j,k:Integer;
Function Max(x,y:Int64):Int64;
Begin
   If x>y Then Max:=x
          Else Max:=y;
End;
Function Gcd(a,b:Int64):Int64;
Begin
   If b=0 Then Gcd:=a
          Else Gcd:=Gcd(b, a mod b);
End;
Begin
   Read(n);
   ans:=1;
   For i:=Max(n-120,1) To n Do
      For j:=Max(n-120,1) To n Do
         For k:=Max(n-120,1) To n Do Begin
            r1:=(int64(i)*int64(j)) div (Gcd(int64(i),int64(j)));
            r2:=(r1*int64(k)) div (Gcd(r1,int64(k)));
            If r2>ans Then Begin
               ans:=r2;
            End;
         End;
   Write(ans);
End.

var i,j,n,k,d1,d2,d3: longint;
    lcm,t: int64;
label 1,2;

Function GCD(a,b: longint): longint;
begin
    while (a>0) and (b>0) do
      if a>b then a:=a mod b else b:=b mod a;
    GCD:=a+b
end;

begin
    readln(n); lcm:=n*(n-1); if n=1 then lcm:=1;
    for i:=n downto 1 do
      for j:=i-1 downto 1 do
        for k:=j-1 downto 1 do
          begin
            d1:=gcd(i,j); d2:=gcd(i,k); d3:=gcd(j,k);
            t:=int64(i)*int64(j)*int64(k) div d1 div d2 div d3;

            if t >lcm then lcm:=t;

            if (d1=1) and (d2=1) and (d3=1) then begin goto 1 end;
          end;
1:
    dec(n);
    for i:=n downto 1 do
      for j:=i-1 downto 1 do
        for k:=j-1 downto 1 do
          begin
            d1:=gcd(i,j); d2:=gcd(i,k); d3:=gcd(j,k);
            t:=int64(i)*int64(j)*int64(k) div d1 div d2 div d3;

            if t >lcm then lcm:=t;

            if (d1=1) and (d2=1) and (d3=1) then begin goto 2 end;
          end;

2:
    writeln(lcm)
end.

uses math;
var
i,j,k,n:longint;
lcm,best,h:int64;

function gcd(x,y:int64):int64;
var g:longint;
begin
 repeat
 g:=x mod y;
 x:=y;
 y:=g;
 until y = 0;
gcd:=x;
end;

begin
//Assign(input,'input.txt');Reset(input);
// Assign(output,'output.txt');Rewrite(output);
Readln(n);
for i:=n-30 to n do
 for j:=n-30 to n do
  for k:=n-30 to n do
   if( i > 0 )and( j > 0 )and( k > 0 ) then
   begin
   h:=i;
   lcm:= h*j div gcd(i,j);
   lcm:= k*lcm div gcd(lcm,k);
   best:=max(best,lcm);
   end;
 Writeln(best);
//Close(input);Close(output);
end.

var
 i,j,m,k,kol,ans,res:longint;
 n:int64;
begin
 readln(n);
 if n<3 then writeln(n) else if odd(n) then writeln(n*(n-1)*(n-2)) else
 if n mod 3=0 then writeln((n-1)*(n-2)*(n-3)) else writeln(n*(n-1)*(n-3));
end.

{$r-,s-,q-,i-,o+}
uses math;
var
  n,i,j,k:longint;
  ans:int64;

  function gcd(a,b:int64):int64;
    begin
      if (b=0) then exit(a) else
        exit(gcd(b,a mod b));
    end;

  function lcm(a,b:int64):int64;
    begin
      exit((a*b) div gcd(a,b));
    end;

begin
  ans:=0;
  readln(n);
  for i:=max(1,n-100) to n do
    for j:=max(1,n-100) to n do
      for k:=max(1,n-100) to n do
        if lcm(i,lcm(j,k))>ans then
          ans:=lcm(i,lcm(j,k));
  writeln(ans);
end.

var
  j:longint;
  n,ans,gg,p,q:qword;
function gcd(a,b:qword):qword;
begin
  if b=0 then exit(a) else gcd:=gcd(b,a mod b);
end;
begin
  readln(n);
  if odd(n) then ans:=(n-1)*n*(n-2) else
    begin
      p:=(n-1)*(n-2)*(n-3);
      q:=n*(n-1);
      for j:=n-2 downto 1 do
       begin
         gg:=gcd(q,j);
        if q*j div gg>p then
          p:=q*j div gg;
       end;
        ans:=p;
    end;
  if n<3 then ans:=n;
  writeln(ans);
end.

uses math;
var
  mar,b : array [1..1000000] of longint;
  n,w,e,max,u : int64;
  i,j : longint;
  function gcd(x,y : int64) : int64;
   begin
    while (x<>0) and (y<>0) do
     begin
      if x>y then x:=x mod y
      else y:=y mod x;
     end;
    gcd:=x+y;
   end;
begin
  readln(n);
  if n<3 then begin writeln(n); exit; end;
  e:=n-1;
  for i:=n-1 downto 2 do
   if I<>e then
    begin
     w:=(i*n) div gcd(i,n);
     w:=(w*e) div gcd(w,e);
     if w>max then max:=w;
    end;
   e:=n-2;
   for i:=n downto 2 do
    if I<>e then
     begin
      w:=(i*(n-1)) div gcd(i,(n-1));
      w:=(w*e) div gcd(w,e);
      if w>max then max:=w;
     end;
  writeln(max);
end.

uses math;
var n: int64;
function gcd(x, y: int64): int64;
begin
        if y = 0 then
                exit(x)
        else
                exit(gcd(y, x mod y));
end;
begin
        readln(n);
        if n < 3 then
                writeln(n)
        else if n mod 2 = 1 then
                writeln(n * (n - 1) * (n - 2))
        else
                writeln(max(n * (n - 1) * (n - 2) div 2, max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3) div gcd(n, n - 3) div gcd(n - 1, n - 3))));
end.

program Project1;
{$MAXSTACKSIZE 64000000}
{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  n: int64;

function gcd(m, n: int64): int64;
var
  f: integer;
begin
  f := m mod n;
  if f = 0 then
    gcd := n
  else
    gcd := gcd(n, f)
end;

var
  m: array [1 .. 5] of int64;
  mqax: int64;

procedure gen(a: integer);
var
  i: integer;
begin
  if a = 4 then
  begin
    mqax := max(mqax, ((m[1] * m[2] * m[3]) div (gcd(m[3], m[2]) * gcd(m[1],
      m[3]) * gcd(m[1], m[2]) * gcd(m[1], gcd(m[2], m[3])))));
  end
  else
  begin
    for i := n downto n - 4 do
    begin
      m[a] := i;
      gen(a + 1);
    end;
  end;
end;

begin
  readln(n);
  if n = 1 then
  begin
    writeln('1');
    exit;
  end
  else if n = 2 then
  begin
    writeln('2');
    exit;
  end
  else if n = 3 then
  begin
    writeln('6');
    exit;
  end
  else if n = 4 then
  begin
    writeln('12');
    exit;
  end;
  mqax := 0;
  gen(1);
  writeln(mqax);
  readln;

end.

var s,n:int64;
function ucln(a,b:int64):int64;
begin
    if b=0 then exit(a);
    exit(ucln(b,a mod b));
end;
begin
    readln(n);
    if n<3 then s:=n else
    if n=3 then s:=6 else
    if n=4 then s:=12 else
    begin
                    s:=n*(n-1)*(n-2);
                    if ucln(n,n-2)<>1 then s:=(n-1)*(n-3)*(n-2);
    if (n*(n-1)*(n-3)>s)and (ucln(n,n-3)=1) then s:=n*(n-1)*(n-3);
    end;
    write(s);
    readln;
end.

uses math;
var
i,j,k,n:longint;
lcm,best,h:int64;

function gcd(x,y:int64):int64;
var g:longint;
begin
 repeat
 g:=x mod y;
 x:=y;
 y:=g;
 until y = 0;
gcd:=x;
end;

begin
//Assign(input,'input.txt');Reset(input);
// Assign(output,'output.txt');Rewrite(output);
Readln(n);
for i:=n-5 to n do
 for j:=n-5 to n do
  for k:=n-5 to n do
   if( i > 0 )and( j > 0 )and( k > 0 ) then
   begin
   h:=i;
   lcm:= h*j div gcd(i,j);
   lcm:= k*lcm div gcd(lcm,k);
   best:=max(best,lcm);
   end;
 Writeln(best);
//Close(input);Close(output);
end.

var
      n : int64;

function max(a, b : int64) : int64;
begin
      if a > b then
            max := a
      else
            max := b;
end;

function nok(a, b : int64) : int64;
var
        a1, b1 : int64;

begin
        a1 := a;
        b1 := b;
        while (a > 0) and (b > 0) do
                if a > b then
                        a := a mod b
                else
                        b := b mod a;
        nok := a1 * b1 div (a + b);
end;

begin
        readln(n);
        if n < 3 then
            begin
                writeln(n);
                halt;
                end;
        if n mod 2 = 1 then
            writeln(nok(nok(n, n - 1), n - 2))
        else
            writeln(max(max(nok(nok(n, n - 1), n - 2), nok(nok(n, n - 1), n - 3)), nok(nok(n - 1, n - 2), n - 3)));
end.

uses math;
const lim = 100;

procedure swap( var a, b : int64 );
var w : int64;
begin
  w:=a; a:=b; b:=w;
end;

function GCD( a , b : int64 ): int64;
begin

  if b > a then swap( a , b );

  while b > 0 do begin
    a:=a mod b;
    swap( a , b );
  end;

  exit( a );

end;

function LCM( a ,b : int64 ):int64;
begin

  a:=(a * b) div GCD( a , b );

  exit( a );

end;

var a , b , c , lb , ub  , n : longint;
    ans : int64;
begin

  readln( n );

  ub:=n;

  n:=n - lim;

  if n <= 0 then lb:=1
  else lb:=n;

  ans:=0;

  for a:=lb to ub do begin
    for b:=a to ub do begin
      for c:=b to ub do begin
        ans:=max( ans , LCM( LCM( int64(a) , int64(b) ) , int64(c) ) );
      end;
    end;
  end;

  writeln( ans );

end.

program prob;

{$APPTYPE CONSOLE}
{$O+}

uses
  SysUtils,Math;

type point=record
  x,y:extended;
end;

var n,m,k,i,j:integer;
    ans,mx:int64;

function gcd(a,b:integer):integer;
begin
while (a<>0) and (b<>0) do
if a>b then
  a:=a mod b
else
  b:=b mod a;
gcd:=a+b;
end;

begin
  {$IFNDEF ONLINE_JUDGE}
  reset(input, 'input.txt');
  rewrite(output, 'output.txt');
  {$ENDIF}
  read(n);
  if n=1 then begin
    write(1);
    halt;
  end;
  if n=2 then begin
    write(2);
    halt;
  end;
  if n=3 then begin
    write(6);
    halt;
  end;
  mx:=0;
  for j:=n downto max(3,n-10) do begin
  ans:=int64(j)*int64(j-1);
  i:=j-2;
  while (gcd(j,i)<>1) or (gcd(j-1,i)<>1) do
    dec(i);
  if mx<ans*int64(i) then mx:=ans*int64(i);
  end;
  write(mx);
end.

var     n, tmp, res: int64;
        i: longint;
        a, b, e: int64;

Function Max(a, b: int64): int64;
begin
        if a > b then exit(a) else exit(b);
end;

Function ucln(a, b: int64): int64;
var     tmp: int64;
begin
        if a mod b = 0 then exit(b)
        else
                exit(ucln(b, a mod b));
end;

Procedure Solve;
begin
        tmp := n*(n-1);
        res := (n-1)*(n-2)*(n-3);
        for i := n-2 downto 2 do
        begin
                e := i;
                b := ucln(e, tmp);
                a := (tmp*e)div b;
                res := Max(a, res);
        end;
        writeln(res);
end;

Begin
        read(n);
        if n = 1 then write(1);
        if n = 2 then write(2);
        if n = 3 then write(6);
        if n = 4 then write(12);
        if n <= 4 then exit;
        if odd(n) then write(n*(n-1)*(n-2))
        else
                begin
                       Solve;
                end;
end.

program CF_236C;
var
  x,y,z:array[0..20] of integer
  ;
  n,a,b,c,i,j:longint;
  s:int64;

procedure times;
  var i,j:longint;
  begin
    for i:=1 to x[0] do
      for j:=1 to y[0] do
        z[i+j-1]:=z[i+j-1]+x[i]*y[j];
    for i:=1 to x[0]+y[0]-1 do begin
      z[i+1]:=z[i+1]+z[i] div 10;
      z[i]:=z[i] mod 10;
    end;
    z[0]:=x[0]+y[0];
    if z[x[0]+y[0]]=0 then dec(z[0]);
  end;

begin
  readln(n);
  if n=1 then begin
    writeln(1);
    halt;
  end;
  if n=2 then begin
    writeln(2);
    halt;
  end;
  if n mod 2=0
    then begin
      a:=n-3;
      b:=n-1;
      c:=n;
    end
    else begin
      a:=n-2;
      b:=n;
      c:=n-1;
    end;
  if c mod 3=0 then
    if (a mod 3=0) or (b mod 3=0) then c:=c-2;
  x[0]:=0;y[0]:=0;
  while a>0 do begin
    inc(x[0]);
    x[x[0]]:=a mod 10;
    a:=a div 10;
  end;
  while b>0 do begin
    inc(y[0]);
    y[y[0]]:=b mod 10;
    b:=b div 10;
  end;
  fillchar(z,sizeof(z),0);
  times;x:=z;
  fillchar(y,sizeof(y),0);
  fillchar(z,sizeof(z),0);
  while c>0 do begin
    inc(y[0]);
    y[y[0]]:=c mod 10;
    c:=c div 10;
  end;
  times;
  for i:=z[0] downto 1 do
    write(z[i]);
  writeln;
end.

var
  n:Qword;
  x:Qword;
begin
  readln(n);
  if n=1 then begin writeln(1);halt;end;
  if n=2 then begin writeln(2);halt;end;
  if n=3 then begin writeln(6);halt;end;
  if odd(n) then x:=n*(n-1)*(n-2)
  else begin
         if n mod 3=0 then x:=(n-1)*(n-2)*(n-3)
                      else x:=n*(n-1)*(n-3);
       end;
  writeln(x);
end.

program a235;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };

 var
   a, x, xx: int64;
 begin
   readln(a);
   if a<3 then x:=a else if odd(a) then x:=a*(a-1)*(a-2)
   else if a mod 3=0 then x:=(a-1)*(a-2)*(a-3)
   else x:=a*(a-1)*(a-3);
   writeln(x);
 end.

uses math;
var    n,p,p1,p2,maxi:int64;
i,j,k:longint;
function gcd(a,b:int64):int64;
var temp:int64;
 begin
 if a<b then
  begin
  temp:=a;
  a:=b;
  b:=temp;
  end;
  if a mod b=0 then exit(b) else
  exit(gcd(b,a mod b));
 end;

 begin
  read(n);
  if n<3 then writeln(n) else
   begin
   maxi:=0;
   for i:=n downto max(n-100,1) do
   for j:=n downto max(n-100,1) do
   for k:=n downto max(n-100,1) do
    begin
    p:=i;
    p1:=j;
    p2:=k;
    if (((p*p1) div gcd(p,p1))*p2) div gcd ((p*p1) div gcd(p,p1),p2)
 >maxi then
    maxi:=(((p*p1) div gcd(p,p1))*p2) div gcd ((p*p1) div gcd(p,p1),p2);
   end;

  writeln(maxi);
end;
end.

var
  n : int64;
  hasil : int64;
begin
  readln (n);
  if n = 1 then writeln (1) else
  if n = 2 then writeln (2) else
  if n = 3 then writeln (6) else
  if n mod 2 = 1 then begin
    hasil := n * (n-1) * (n-2);
    //writeln (n, n-1, n-2);
    writeln (hasil);
  end else begin
    if n mod 3 = 0 then hasil := (n-1) * (n-2) * (n-3)
    else hasil := n * (n-1) * (n-3);
    //writeln (n, n-1, n-3);
    writeln (hasil);
  end;
end.

program chip;
var
  ans,n: int64;

  procedure enter;

  begin
    assign(input,'');
    reset(input);
    readln(n);
    close(input);
  end;

  procedure run;

  begin
    if n<3 then
      begin
        ans:=n;
        exit;
      end;
    if n mod 2=1 then
      begin
        ans:=n*(n-1)*(n-2);
        exit;
      end;
    if n mod 3<>0 then
      begin
        ans:=n*(n-1)*(n-3);
        exit;
      end;
    ans:=(n-1)*(n-2)*(n-3);
  end;

  procedure answer;

  begin
    assign(output,'');
    rewrite(output);
    writeln(ans);
    close(output);
  end;

begin
  enter;
  run;
  answer;
end.

program cd146c;

{$APPTYPE CONSOLE}
uses math;
var n,n1,n2,n3,nok,mn,i,j,k:Int64;
    a,b,c:longint;

function nod(x,y:int64):int64;
 begin
  repeat
   if x>y then x:=x mod y else y:=y mod x;
  until(x=0) or (y=0);
  nod:=x+y;
 end;

begin
 { Assign(input,'input.txt');Reset(input);
  assign(output,'output.txt');rewrite(output);}
  read(n);
  for a:=n downto Max(n-50,1) do
   for b:=a downto Max(n-50,1) do
    for c:=b downto Max(n-50,1) do
     begin
       i:=a;j:=b;k:=c;
       n1:=i*j div nod(i,j);
       n2:=i*k div nod(i,k);
       n3:=j*k div nod(j,k);
       nok:=Min(k*n1 div nod(k,n1),Min(j*n2 div nod(j,n2),i*n3 div nod(i,n3)));
       if nok>mn then mn:=nok;
     end;
   write(mn);
end.

var w,res,n:int64;
    q,i,j,k:longint;
 function nsk(x,y:int64):int64;
 var res:int64;
  begin
    res:=x*y;
    while (x>0) and (y>0) do
     if x>y then x:=x mod y
            else y:=y mod x;
    nsk:=res div (x+y);
  end;
 begin
  read(n);
  for i:=1 to n do
   begin
     w:=nsk(n*(n-1),i);
     if w>res then res:=w;
   end;
  q:=1;
  if n-51>q then q:=n-51;
  for i:=q to n do
   for j:=q to n do
    for k:=q to n do
     begin
      w:=nsk(i,nsk(j,k));
      if w>res then res:=w;
     end;
  writeln(res);
 end.

var  n,max:int64;
begin
readln(n);
if n<3 then begin write(n); halt; end;
if odd(n) then max:=n*(n-1)*(n-2) else begin
if n mod 3=0 then max:=(n-2)*(n-1)*(n-3) else max:=n*(n-1)*(n-3);
if (n*(n-1)*(n-2) div 2>max)then  max:=n*(n-1)*(n-2) div 2;
end;
write(max);
end.

uses math;
var
kk,k:int64;
l,r,x1,y1,nn,inf,x,y,dd,ans,j,v,ss,i,n,m,s:longint;
mark,q,dp,xx,yy,mas2:array[0..100003] of  longint;
a:array[0..4003,0..4000] of  longint;
ch:char;
function gcd(b,a:int64):int64;
begin
{writeln (b,a);}
if a=0 then gcd:=b
else gcd:=gcd(a,b mod a);
end;
begin
readln (n);
if n=1 then begin writeln (1);halt end else
if n=2 then begin writeln (2);halt end else
if n=3 then begin writeln (6);halt end;
if n=4 then begin writeln (12);halt end;

i:=n-1;
for i:=max(1,n-100) to n do
 for j:=max(1,n-100) to n do
   for m:=max(1,n-100) to n do

  begin
  kk:=(i) div gcd(i,j)*(j);
  k:=max (k, m div gcd(m,kk)*kk   );
  end;

writeln (k);
END.

var
     N,Ans,Q,Z,u:Int64;
     i,j,k:Longint;
function Nod(X,Y:Int64):Int64;
begin
     while (X>0) and (Y>0) do
     if X>Y then X:=X mod Y
            else Y:=Y mod X;
     Nod:=X+Y;
 end;
begin
     Readln(N);
     for i:=N-5 to N do
     for j:=N-5 to N do
     for k:=N-5 to N do
     if (i>0) and (j>0) and (k>0) then
begin
     u:=i;
     Q:=u*j div Nod(u,j);
     Z:=Q*k div Nod(Q,k);
     if Z>=Ans then Ans:=Z;
 end;
     Writeln(Ans);
 end.

program Project1;
Uses math;
Var i,j,i1,n:longint;
i2,z,a,b,maxNok:int64;
function nod(a,b:int64):int64;
begin
  if b>a
  then nod:=nod(b,a)
  else if b=0
       then nod:=a
       else nod:=nod(b,a mod b);
end;
begin
//  Assign(input,'input.txt'); Assign(output,'output.txt');
  maxNok:=0;
  readln(n);
  for i:=n downto max(n-20,1) do
  for j:=n downto max(1,n-20) do
  for i1:=n downto max(1,n-20) do
  begin
    z:=nod(i,j);
    i2:=i; b:=j;
    a:=(i2*b) div z;
    b:=i1;
    z:=nod(a,b);
    if (a*b div z)>maxNok
    then maxNok:=a*b div z;
  end;
  writeln(maxNok);
end.

uses math;
var
    answer,i,j,n,x,y,z:int64;

function nod(a,b:int64):int64;
begin
  while (a>0) and (b>0) do
    if a>b then a:=a mod b else b:=b mod a;
  nod:=a+b;
end;

begin

  readln(n); answer:=0; x:=max(n-3,1);
  while x<=n do
    begin
      y:=max(n-3,1); while y<=n do
      begin
        z:=max(n-3,1); while z<=n do
        begin
          i:=nod(x,y); i:=(x*y) div i;
          j:=nod(i,z); j:=(i*z) div j;
          answer:=max(answer,j); inc(z);
        end;
        inc(y);
      end;
      inc(x);
    end;
  writeln(answer);

end.

program c;
var a,k: uint64;
begin
readln(k);
if (k>2) then
if k mod 2 = 1 then a:=k*(k-1)*(k-2) else
if k mod 3 = 0 then a:=(k-1)*(k-2)*(k-3) else a:=k*(k-1)*(k-3) else
if k=2 then a:=2 else a:=1;
writeln(a);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  a1, a2, j, mx, z1 : int64;
  n, i : integer;

function gcd(a, b : int64) : int64;
begin
  if (a = 0) or (b = 0) then
    result := a + b
  else
    result := gcd(max(a, b) mod min(a, b), min(a, b));
end;

begin

  read(n);

  mx := n;
  if n mod 2 = 0 then
    a1 := max(1, n - 1)
  else
    a1 := max(1, n);
  a2 := max(1, a1 - 1);
  for i := n downto n div 2 do begin
    j := i;
    z1 := (a1 * a2 * j div gcd(a1 * a2, j));
    mx := max(mx, z1);
  end;

  if n mod 2 = 1 then
    a1 := max(1, n - 1)
  else
    a1 := max(1, n);
  a2 := max(1, a1 - 1);
  for i := n downto n div 2 do begin
    j := i;
    z1 := (a1 * a2 * j div gcd(a1 * a2, j));
    mx := max(mx, z1);
  end;

  writeln(mx);

  readln;readln;
end.

{$mode objfpc}

uses            math;

const           InputFile               =       'ProblemC.inp';
                maxN                    =       trunc( 1E6 );

var             n , res                 :       int64;

procedure Result( res : int64 );
        begin
                writeln( res );
                halt;
        end;

begin
                readln( n );
                if n = 1 then Result( 1 );
                if n = 2 then Result( 2 );
                if n = 3 then Result( 6 );
                if odd( n ) then
                        res := n * ( n - 1 ) * ( n - 2 )
                else
                        begin
                                if n mod 3 = 0 then
                                        res := ( n - 1 ) * ( n - 2 ) * ( n - 3 )
                                else
                                        res := n * ( n - 1 ) * ( n - 3 );
                        end;
                Result( res );
end.

var a,k: int64;
begin
readln(k);
if (k>2) then
if k mod 2 = 1 then a:=k*(k-1)*(k-2) else
if k mod 3 = 0 then a:=(k-1)*(k-2)*(k-3) else a:=k*(k-1)*(k-3) else
if k=2 then a:=2 else a:=1;
writeln(a);
end.

var
i,j:longint;
nod1,f,q,nod,g,p1,x,ans,d,kol,p,n:int64;
a:array[-100..3000]of longint;
begin
readln(n);

if n<=2 then writeln(n)
else
if n=3 then writeln(6)
else begin
    if n mod 2 = 1 then

    writeln(n*(n-1)*(n-2))
    else begin
    ans:=((n-3)*(n-1)*(n-2));

    for i:=n-2 downto 1 do begin
        q:=n;
        f:=i;
        while (q>0)and(f>0) do begin
            if q>f then q:=q mod f
            else
            f:=f mod q;
        end;
         nod:=f+q;
        f:=i;
        q:=n-1;
        while (f>0)and(q>0) do begin
            if q>f then q:=q mod f
            else
            f:=f mod q;
        end;

        nod1:=f+q;

 if ((n div nod)*((n-1) div nod1)*((i div nod) div nod1)*nod*nod1)>ans then ans:=(n div nod)*((n-1) div nod1)*((i div nod) div nod1)*nod*nod1;

    end;
           writeln(AnS);
    end;

end;
end.

{$APPTYPE CONSOLE}

uses
  SysUtils,math;
var i,j,k,n : integer;
r ,ans : int64;
function gcd(a,b : int64) : int64;
begin
 while a*b>0 do
  if (a>b) then a:=a mod b
  else
   b:=b mod a;
 gcd:=a+b;
end;
begin
 readln(n);
 ans := 0;
 for i:=n downto max(1,n-100) do
  for j:=n downto max(1,n-100) do
   for k:=n downto max(1,n-100) do
   begin
    r := int64(i) div gcd(i,j) * j;
    r := int64(r) div gcd(r,k) * k;
    if (r > ans) then ans := r;
   end;
  writeln(ans);
end.

function max(a,b:longint):longint;
begin
if a>b then max:=a
else max:=b;
end;

function nod(a,b:int64):int64;
var
a1,b1:int64;
begin
a1:=a;
b1:=b;
      while (a1>0) and (b1>0) do
      if a1>b1 then a1:=a1 mod b1
      else b1:=b1 mod a1;
      nod:=(a*b) div (a1+b1);
end;

function nok(a,b,c:int64):int64;
var
s1:int64;
begin
s1:=nod(a,b);
nok:=nod(s1,c);
end;

var
n,i,j,k:longint;
ans,t:int64;
begin

readln(n);
if n>2 then
        begin
        ans:=nok(n,n-1,n-2);

        for i:=n downto max(n-100,1) do
        for j:=n downto max(n-100,1) do
        for k:=n downto max(n-100,1) do
        if nok(i,j,k)>ans then ans:=nok(i,j,k);

        write(ans);
        exit;
        end;
write(n);

end.

program pc;
var
        n , mm , dd : int64;
begin
        readln ( n );
        mm := n mod 3;
        dd := n div 3;
        if n = 1 then begin writeln ( 1 ); exit; end;
        if n = 2 then begin writeln ( 2 ); exit; end;
        if n = 3 then begin writeln ( 6 ); exit; end;
        if mm = 0 then
                begin
                        if dd and 1 = 0 then writeln ( ( n - 3 ) * ( n - 1 ) * ( n - 2 ) )
                        else writeln ( n * (n - 1) * ( n - 2 ) );
                end
        else
                if mm = 1 then
                        begin
                                if dd  and  1 = 0 then writeln ( n * (n - 1) * ( n - 2 )  )
                                else writeln ( n * (n - 1) * ( n - 3 ) );
                        end
                else
                        begin
                                if dd and  1 = 1 then writeln ( n * (n - 1) * ( n - 2 ) )
                                else writeln ( n * (n - 1) * ( n - 3 ) );
                        end;
end.

var
 i1,i2,i3,j,n,m,k:longint;
 ans:int64;

 function max(x,y:int64):int64;
  begin
   if x>y then max:=x
    else max:=y;
  end;

 function gcd(x,y:int64):int64;
  begin
   while (X<>0)and(y<>0) do
    if x>y then x:=x mod y
     else y:=y mod x;
   exit(x+y);
  end;

 function fun(x,y,z:int64):int64;
 var
  k:int64;
  begin
   if (x<=0)or(y<=0)or(z<=0) then exit(-maxlongint);
   k:=(x*y) div gcd(x,y);
   exit((k*z) div gcd(k,z));
  end;

begin
 readln(n);
 for i1:=0 to 10 do
  for i2:=0 to 10 do
   for i3:=0 to 10 do
     ans:=max(ans,fun(n-i1,n-i2,n-i3));
 writeln(ans);
end.

uses math;
type mass=array[1..1000000] of int64;
var r,l,a,z,i,c,k,b,j:integer;s,s1:string;u:boolean;n,res,de:int64;m:mass;
begin
//  reset(input,'input.txt');
//  assign(output,'output.txt');
  readln(n);
  if n=1
  then writeln(1)
  else if n<4
       then writeln((n-1)*n)
       else if n mod 2=1
            then writeln((n-1)*(n-2)*n)
            else if n mod 3=0
                 then writeln((n-1)*(n-2)*(n-3))
                 else writeln((n-1)*n*(n-3));
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils,math;

{Procedure QSort(m, t: Integer);
Var i, j, x, w: Integer;
Begin
  i:=m; j:=t; x:=A[random(t-m+1)+m];
  Repeat
    While A[i]<x Do Inc(i);
    While A[j]>x Do Dec(j);
    If i<=j Then Begin
      w:=A[i]; A[i]:=A[j]; A[j]:=w;
      Inc(i); Dec(j);
    End
  Until i>j;
  If m<j Then QSort(m, j);
  If i<t Then QSort(i, t);
End;   }

           {
function gcd(a,b:integer):integer;
begin
if b=0 then gcd:=a
       else gcd:=gcd(b,a mod b);
end;

function search(str:string):integer;
var i,x:integer;
begin
x:=0;
for i:=1 to  do
 if team[i]=str then begin x:=i; break; end;
search:=x;
end;

}

var a,b,c,x,ans,n:int64;
    i:longint;

function gcd(a,b:int64):int64;
begin
if b=0 then gcd:=a
       else gcd:=gcd(b,a mod b);
end;

function lcm(a,b:int64):int64;
begin
lcm:=a div gcd(a,b) * b;
end;

begin
//assign(input,'in.txt'); reset(input);
//assign(output,'out.txt'); rewrite(output);
readln(n);
if n=1 then begin writeln(1); halt; end;
if n=2 then begin writeln(2); halt; end;
a:=n; b:=n-1; c:=n;
ans:=-1;
for i:=c downto 1 do
 begin
  x:=lcm(a*b,i);
  if x>ans then ans:=x;
 end;

a:=n-1; b:=n-2; c:=n;
for i:=c downto 1 do
 begin
  x:=lcm(a*b,i);
  if x>ans then ans:=x;
 end;

writeln(ans);
//readln;
//close(input); close(output);
end.

var n,s:int64;
function max(x,y:int64):int64;
 begin
  if x>y then max:=x else max:=y;
 end;
function nod(x,y:int64):int64;
  var s:int64;
   begin
    s:=x*y;
    while (x>0)and(y>0)do
     if x>y then x:=x mod y
            else y:=y mod x;
    nod:=s div(x+y);
   end;
begin
 readln(n);
 if n=2 then begin writeln(2);exit; end;
 if n=1 then writeln(1) else begin
             s:=nod(n,nod(n-1,n-2));
             s:=max(s,nod(n,nod(n-1,n-3)));
             s:=max(s,nod(n,nod(n-3,n-2)));
             s:=max(s,nod(n-3,nod(n-1,n-2)));
             writeln(s);
             end;
             end.

uses math;
var
  n, res : int64;
begin
  read(n);
  if n = 1 then writeln(1)
  else
  if n = 2 then writeln(2)
  else
  if n = 3 then writeln(6)
  else
  if n = 6 then writeln(60)
  else
  if (n mod 6 = 0) then
    begin
      res := (n-1)*(n-2)*(n-3);
      writeln(res);
    end
  else
  if n mod 2 = 0 then
    begin
      res := n*(n-1)*(n-3);
      writeln( res );
    end
  else
    begin
    res := n*(n-1)*(n-2);
    writeln(res);
    end;
end.

var
n:int64;
begin
readln(n);
if(n<=2) then writeln(n)
else
if(n mod 2=1) then writeln(n*(n-1)*(n-2))
else
if(n mod 3<>0) then writeln(n*(n-1)*(n-3))
else
writeln((n-1)*(n-2)*(n-3));
end.

var a,b,c,x,n,y,aa,bb,cc:int64;
 begin
  read(n);
  if n=1 then writeln(1)
  else
  if n mod 2=1 then writeln(n*(n-1)*(n-2))
  else
  if n=2 then writeln(2)
  else
  if n mod 3=0 then writeln((n-1)*(n-2)*(n-3))
               else writeln(n*(n-1)*(n-3));
 end.

{$Mode objfpc}

uses math;

var
    n: int64;

begin
    readln(n);
    if n= 1 then writeln(1) else
        if n= 2 then writeln(2) else
            if odd(n) then writeln(n*(n- 1)*(n- 2)) else
                begin
                   if n mod 3= 0 then writeln((n- 1)* (n- 2)*(n- 3)) else writeln(n*(n- 1)*(n- 3));
                end;

end.

var  n,max:int64;
begin
readln(n);
if n<3 then begin write(n); halt; end;
if odd(n) then max:=n*(n-1)*(n-2) else begin
if n mod 3=0 then max:=(n-2)*(n-1)*(n-3) else max:=n*(n-1)*(n-3);
if (n*(n-1)*(n-2) div 2>max)then  max:=n*(n-1)*(n-2) div 2;
end;
write(max);
end.

var w,res,n:int64;
    q,i,j,k:longint;
 function nsk(x,y:int64):int64;
 var res:int64;
  begin
    res:=x*y;
    while (x>0) and (y>0) do
     if x>y then x:=x mod y
            else y:=y mod x;
    nsk:=res div (x+y);
  end;
 begin
  read(n);
  for i:=1 to n do
   begin
     w:=nsk(n*(n-1),i);
     if w>res then res:=w;
   end;
  q:=1;
  if n-51>q then q:=n-51;
  for i:=q to n do
   for j:=q to n do
    for k:=q to n do
     begin
      w:=nsk(i,nsk(j,k));
      if w>res then res:=w;
     end;
  writeln(res);
 end.

uses math;
var
 i,j,k:longint;
 n:int64;
 ans,tmp,s:int64;
function gcd(a,b:int64):int64;
 var
  r:int64;
 begin
  repeat
   r:=a mod b;
   a:=b;b:=r;
  until r=0;
  exit(a);
 end;
begin
 readln(n);s:=n*(n-1);ans:=0;
 if n=1 then begin
  writeln(1);halt;
 end;
 if n=2 then begin
  writeln(2);halt;
 end;
 for i:=n-2 downto 1 do begin
  tmp:=s*i div gcd(s,i);
  ans:=max(ans,tmp);
 end;
 ans:=max(ans,(n-1)*(n-2)*(n-3));
 writeln(ans);
end.

uses math;
var n: int64;
function gcd(x, y: int64): int64;
begin
        if y = 0 then
                exit(x)
        else
                exit(gcd(y, x mod y));
end;
begin
        readln(n);
        if n < 3 then
                writeln(n)
        else if n mod 2 = 1 then
                writeln(n * (n - 1) * (n - 2))
        else
                writeln(max(n * (n - 1) * (n - 2) div 2, max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3) div gcd(n, n - 3) div gcd(n - 1, n - 3))));
end.

program adsf;
var
i,j:longint;
n,ans,c,b:qword;
 function gcd(a,b:qword):qword;
         begin
         if a mod b=0 then exit(b);
         exit(gcd(b, a mod b));
         end;
begin
readln(n);b:=0; if n=1 then begin
writeln(1);halt;end;if n=2 then begin writeln(2);halt;end;
if n=3 then begin writeln(6);halt;end;

c:=(n-1)*(n-2);
b:=(n-1)*n;

    for i:=n downto 1 do begin
    if (gcd(i,n-1)=1 )and(gcd(i,n-2)=1) then
    begin
 ans:=i*c;break;end; end;

for i:=n-2 downto 1 do begin
if (gcd(i,n)=1)and(gcd(i,n-1)=1) then begin

if b*i>ans then ans:=b*i;
writeln(ans);
break;end;

                   end;

end.

                program pr1;

{$APPTYPE CONSOLE}

const besk=200000000000000;
   nnn=2000000; modul=1000000007;
 label 1,2,3,4;
var p1,p2,step,y,n1,m1,pl,i1,i2,i0,j0,jj,kol,k,kk,shag,i,j,ii,start,finish,pp:longint;
t1,t2,t3,n,ot,raz,l,r,numgr,c,a,x,b,pmin,pmax,s,smax,imax,jmax,t,ot1,ot2,p,nn,tt,kor,bal,dx1,dy1,t1old,t2old,f,mmin,imin,m,k1,k2,a2:int64;
centr,koef:int64;
ch,ch1,ch2:char;
est:array[0..1000] of boolean;
och,ost:array[0..200002] of int64;
green,red:array[-20..200,-20..40000] of longint;
flag2,flag1,flag:boolean;
tr,rt:extended;
vz,prost:array[-10..3000000] of boolean;
c1,c2:char;
cc1,cc2,aa,bb,cc,h:extended;
marked:array[-5..52,0..52,0..52,0..52] of boolean;
{stop:array[0..200] of longint; }
zan:array[0..1000] of boolean;
dd :extended;
ss:string;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:int64):int64; var p,t:int64;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function pprost(k:longint):boolean;  var i,j,s:longint; t:double; fl:boolean;
begin
  t:=sqrt(k); fl:=true;
   s:=round(t);
    for i:=2 to s do if k mod i=0 then fl:=false;
  pprost:=fl;

end;

  function nok(a,b,c:int64):int64; var k,p,t:int64;
begin
   k:=a*b div nod(a,b);
   p:=c*k div nod(c,k);
 nok:=p;
end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}      read(n);
        if n<202  then
          begin
             for i:=1 to n do for j:=i to n do for k:=j to n do
               if nok(i,j,k)>imax then begin imax:=nok(i,j,k); a:=i;b:=j; c:=k;  end;
            writeln(imax); goto 1;
          end;
        if odd(n) then begin  writeln(n*(n-1)*(n-2)); goto 1;     end;
      p:=n*(n-1);
      k:=n-1;
      for i:=n downto n-200 do for j:=i-1 downto (n-200) do for k:=j-1 downto (n-200) do
    begin
       t1:=i;t2:=j;t3:=k;
       s:=nok(t1,t2,t3);
       if s>t then begin  a:=t1;b:=t2; c:=t3; t:=s;      end;

    end;
    {
      repeat dec(k); if nok(n,n-1,k)>imax then imax:=nok(n,n-1,k);
      until pprost(k)or(k<n-50);
      writeln(max((n-1)*(n-2)*(n-3),imax));
   }
      writeln(t{,' ',a,' ', b,' ',c});

     1: close (output);
     end.

{$r-,s-,q-,i-,o+}
uses math;
var
  n,i,j,k:longint;
  ans:int64;

  function gcd(a,b:int64):int64;
    begin
      if (b=0) then exit(a) else
        exit(gcd(b,a mod b));
    end;

  function lcm(a,b:int64):int64;
    begin
      exit((a*b) div gcd(a,b));
    end;

begin
  ans:=0;
  readln(n);
  for i:=max(1,n-100) to n do
    for j:=max(1,n-100) to n do
      for k:=max(1,n-100) to n do
        if lcm(i,lcm(j,k))>ans then
          ans:=lcm(i,lcm(j,k));
  writeln(ans);
end.

var n,x1,y1,y:int64;
function gcd(x,y:int64):int64;
begin
if x mod y=0 then exit(y);
exit(gcd(y,x mod y));
end;

begin
readln(n);
if n<=2 then writeln(n)
  else
if n mod 2=1 then writeln(n*(n-1)*(n-2))
  else
    begin
    x1:=(n-1)*(n-2)*(n-3);
    y:=n*(n-1);
    y1:=y*(n-3) div gcd(y,n-3);
    if x1>y1 then writeln(x1) else writeln(y1);
    end;
end.

var i: LongInt;
 n,c, max: int64;

function NOD(x,y: Int64): Int64;
Begin
  If x<>0 then NOD:=NOD(y mod x,x) else NOD:=y;
End;

function NOK(x,y: Int64): Int64;
Begin
  NOK:=(x div NOD (x,y))*y;
end;

begin
  Readln(n);
  max:=0;

  if n=1 then
  begin
    Writeln('1');
    halt(0);
  end;

  if n=2 then
  begin
    Writeln('2');
    halt(0);
  end;

  for i:=n downto 3 do
  begin
    c:=NOK(i,i-1);
    c:=NOK(c, i-2);
    if c>max then max:=c;

    c:=NOK(i,i-1);
    c:=NOK(c, i-3);
    if c>max then max:=c;

    c:=NOK(i-1,i-2);
    c:=NOK(c, i-3);
    if c>max then max:=c;
  end;

Writeln(max);

end.

uses math;
var i,j,z,xz,xj,xi,n,ans,x:int64;
function nod (a,b:int64):int64;
  begin
    while (a>0) and (b>0) do
      if a>b then a:=a mod b else b:=b mod a;
    nod:=a+b;
  end;
function nok (a,b:int64):int64;
  begin
    nok:=(a div nod(a,b))*b;
  end;
begin               {
assign (input,'input.txt');
assign (output,'output.txt');
reset (input);
rewrite (output); }
readln (n);
if n<3 then
  begin
    write (n);
    halt;
  end;
if n mod 2=1 then write (nok(nok(n,n-1),n-2)) else
write ( max(max(nok(nok(n,n-1),n-2),nok(nok(n,n-1),n-3)),
            max(nok(nok(n,n-3),n-2),nok(nok(n-3,n-1),n-2))    )   )
end.

uses math;
var
  mar,b : array [1..1000000] of longint;
  n,w,e,max,u : int64;
  i,j : longint;
  function gcd(x,y : int64) : int64;
   begin
    while (x<>0) and (y<>0) do
     begin
      if x>y then x:=x mod y
      else y:=y mod x;
     end;
    gcd:=x+y;
   end;
begin
  readln(n);
  if n<3 then begin writeln(n); exit; end;
  for j:=1 to min(2,n) do
   begin
    e:=n-j;
    for i:=n-1 downto 2 do
    if I<>e then
     begin
      w:=(i*n) div gcd(i,n);
      w:=(w*e) div gcd(w,e);
      if w>max then max:=w;
     end;
   end;
  for j:=2 to min(2,n) do
   begin
    e:=n-j;
    for i:=n downto 2 do
    if I<>e then
     begin
      w:=(i*(n-1)) div gcd(i,(n-1));
      w:=(w*e) div gcd(w,e);
      if w>max then max:=w;
     end;
   end;
  writeln(max);
end.

Var
        n       :longint;
        kq,x    :int64;
        i,j,k   :longint;

Function UCLN(a,b:int64):int64;
var
        r       :int64;
begin
        While b>0 do
          begin
            r:=a mod b;
            a:=b;
            b:=r;
          end;
        exit(a);
end;

Function BCNN(a,b,c:int64):int64;
var
        x       :int64;
begin
        x:=(a*b) div UCLN(a,b);
        BCNN:=(x*c) div UCLN(x,c);
end;

begin
        read(n);
        kq:=1;
        for i:=n downto n-100 do
          for j:=n downto n-100 do
            for k:=n downto n-100 do
              if (i>0) and (j>0) and (k>0) then
                begin
                  x:=BCNN(i,j,k);
                  if x>kq then kq:=x;
                end;
        write(kq);
end.

uses math;
var
   n,p,k,r,m:int64;
   i:longint;
function mcd (a,b:int64):int64;
var
     t:int64;
begin
     while (a mod b<>0) do
     begin
        t:=a mod b;
        a:=b;
        b:=t;
     end;
     mcd:=b;
end;
begin
   readln(n);
   if n<=2 then
      writeln(n)
   else
   if n mod 2=1 then
       writeln(n*(n-1)*(n-2))
   else
   begin
      r:=(n-1)*(n-2)*(n-3);
      p:=n*(n-1);
      i:=n-2;
      while i>=1 do
      begin
          m:=mcd(p,i);
          k:=(p div m)*i;
          if k>r then
          begin
             r:=k;
             break;
          end;
          i:=i-1;
          if p*i<=r then
           break;
      end;
      writeln(r);
   end;
end.

var
  j:longint;
  n,ans,gg,p,q:qword;
function gcd(a,b:qword):qword;
begin
  if b=0 then exit(a) else gcd:=gcd(b,a mod b);
end;
begin
  readln(n);
  if odd(n) then ans:=(n-1)*n*(n-2) else
    begin
      p:=(n-1)*(n-2)*(n-3);
      q:=n*(n-1);
      for j:=n-2 downto 1 do
       begin
         gg:=gcd(q,j);
        if q*j div gg>p then
          p:=q*j div gg;
       end;
        ans:=p;
    end;
  if n<3 then ans:=n;
  writeln(ans);
end.

USES MATH;
VAR N,K,L:INT64;
BEGIN
  READ(N);
  IF N<3 THEN
    BEGIN
      IF N=2 THEN WRITELN(2)
      ELSE WRITELN(1);
      HALT(0);
    END;
  if n mod 2=0 then
    begin
      if n mod 3=0 then k:=3
      else k:=1;
      if n mod 2=0 then l:=2
      else l:=1;
      writeln(max(n*(n-1)*(n-3) div k,max(n*(n-1)*(n-2) div l,(n-1)*(n-2)*(n-3))));
    end
  else
    begin
      writeln(n*(n-1)*(n-2));
    end;
END.

var n : int64;
function NO (d1,d2 : int64) : int64;
var x,y : int64;
begin
  x:=d1;
  y:=d2;
  while (x>0)and(y>0) do if x>y then x:=x mod y else y:=y mod x;
  x:=x+y;
  NO:=(d1 div x)*d2;
end;
function NOK (q1,q2,q3 : int64) : int64;
begin
  NOK:=No(No(q1,q2),q3);
end;
function max (x,y : int64) : int64;
begin
  if x>y then max:=x else max:=y;
end;
begin
  readln(n);
  if n=1 then writeln(1) else
  if n=2 then writeln(2) else
  if n=3 then writeln(6) else
  if n=4 then writeln(12) else
  if n=5 then writeln(60) else
  if n mod 2=1 then writeln(Nok(n,n-1,n-2)) else
  if n mod 2=0 then writeln(Max(Nok(n,n-1,n-2),Max(Nok(n,n-1,n-3),Nok(n-1,n-2,n-3))));
end.

var
  n,res:int64;
begin
  read(n);
  if n<=4 then begin
    if n=4 then writeln(12)
    else if n=3 then writeln(6)
    else if n=2 then writeln(2)
    else if n=1 then writeln(1);
  end
  else if n=6 then writeln(60)
  else begin
    if n mod 2<>0 then res:=n*(n-1)*(n-2)
    else if n mod 3=0 then res:=(n-1)*(n-2)*(n-3)
    else res:=n*(n-1)*(n-3);
    writeln(res);
  end;
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils, Math;

var
  i, j, k: integer;
  n: integer;
  i1, t, res: int64;

function gcd(a, b: int64): int64;
begin
  if a = 0 then
    result := b
  else
    if b = 0 then
      result := a
    else
      result := gcd(min(a, b), max(a, b) mod min(a, b));
end;

begin
 // reset(input, 'a.in');
//  rewrite(output, 'a.out');

  readln(n);

  res := 1;
  for i := n downto max(1, n - 150) do begin
    for j := i to n do
      for k := j to n do begin
        i1 := i;
        t := (i1 * j) div gcd(i, j);
        t := (t * k) div gcd(t, k);
        res := max(res, t);
      end;
  end;

  writeln(res);
end.

Var     n,kq:int64;
BEGIN
        readln(n);
        if n=1 then writeln(1);
        if n=2 then writeln(2);
        if n>=3 then
        begin
                if (n mod 2)=1 then writeln((n-2)*(n-1)*n)
                else
                if (n mod 3)=1 then writeln((n-3)*(n-1)*n)
                else
                if (n mod 3)=0 then writeln((n-3)*(n-2)*(n-1))
                else writeln((n-3)*(n-1)*(n));
        end;
END.

var
   s,n:int64;
begin
   readln(n);
   if n = 1 then s:=1
   else
   if n = 2 then s:=2
   else
   if n = 3 then s:=6
   else
   if n mod 2 = 1 then s:=n*(n-1)*(n-2)
   else
   if n mod 3 = 0 then s:=(n-1)*(n-2)*(n-3)
   else
   s:=n*(n-1)*(n-3);
   writeln(s);
end.

{
ID: Hokplex
PROB: LCM Challenge
LANG: PASCAL
}

uses
  math;

var
  n, ans: int64;

procedure scanf;
begin
  readln(n);
end;

procedure process;
begin
  if n <= 2 then ans:= n
  else
    if odd(n) then
      ans:= n * (n - 1) * (n - 2)
    else
      if n mod 3 = 0 then
        ans:= (n - 1) * (n - 2) * (n - 3)
      else
        ans:= n * (n - 1) * (n - 3);
  writeln(ans);
end;

begin
  scanf;
  process;
end.

var s,n:int64;
function ucln(a,b:int64):int64;
begin
    if b=0 then exit(a);
    exit(ucln(b,a mod b));
end;
begin
    readln(n);
    if n<3 then s:=n else
    if n=3 then s:=6 else
    if n=4 then s:=12 else
    begin
                    s:=n*(n-1)*(n-2);
                    if ucln(n,n-2)<>1 then s:=(n-1)*(n-3)*(n-2);
    if (n*(n-1)*(n-3)>s)and (ucln(n,n-3)=1) then s:=n*(n-1)*(n-3);
    end;
    write(s);
    readln;
end.

program chip;
var
  ans,n: int64;

  procedure enter;

  begin
    assign(input,'');
    reset(input);
    readln(n);
    close(input);
  end;

  procedure run;

  begin
    if n<3 then
      begin
        ans:=n;
        exit;
      end;
    if n mod 2=1 then
      begin
        ans:=n*(n-1)*(n-2);
        exit;
      end;
    if n mod 3<>0 then
      begin
        ans:=n*(n-1)*(n-3);
        exit;
      end;
    ans:=(n-1)*(n-2)*(n-3);
  end;

  procedure answer;

  begin
    assign(output,'');
    rewrite(output);
    writeln(ans);
    close(output);
  end;

begin
  enter;
  run;
  answer;
end.

                program pr1;

{$APPTYPE CONSOLE}

const besk=200000000000000;
   nnn=2000000; modul=1000000007;
 label 1,2,3,4;
var p1,p2,step,y,n1,m1,pl,i1,i2,i0,j0,jj,kol,k,kk,shag,i,j,ii,start,finish,pp:longint;
t1,t2,t3,n,ot,raz,l,r,numgr,c,a,x,b,pmin,pmax,s,smax,imax,jmax,t,ot1,ot2,p,nn,tt,kor,bal,dx1,dy1,t1old,t2old,f,mmin,imin,m,k1,k2,a2:int64;
centr,koef:int64;
ch,ch1,ch2:char;
est:array[0..1000] of boolean;
och,ost:array[0..200002] of int64;
green,red:array[-20..200,-20..40000] of longint;
flag2,flag1,flag:boolean;
tr,rt:extended;
vz,prost:array[-10..3000000] of boolean;
c1,c2:char;
cc1,cc2,aa,bb,cc,h:extended;
marked:array[-5..52,0..52,0..52,0..52] of boolean;
{stop:array[0..200] of longint; }
zan:array[0..1000] of boolean;
dd :extended;
ss:string;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

function nod(a,b:int64):int64; var p,t:int64;
begin if (a>0)and(b>0) then
   begin while (b>0) do begin t:=a mod b;a:=b;b:=t;    end;
    p:=a;
   end else if a=0 then p:=b else p:=a;
nod:=p;
end;

 function luck(a:longint):boolean;
 var i,j,k:longint;flag:boolean;
 c: array[0..10] of longint;
begin
  flag:=true;  j:=0;
  k:=a;
  while k>0 do begin inc(j); c[j]:=k mod 10; k:= k div 10; {writeln(j,' uu ',k); }  end;
 for i:=1 to j do if (c[i]<>4)and(c[i]<>7) then flag:=false;
 luck:=flag;
end;

{  procedure DFS(vi: longint);
var i,j: longint;
Begin

  marked[vi] := true;
  num[vi]:=p;
  For i := 1 to n do
  if gr[vi, i]  and (not marked[i]) then begin dfs(i); p:=p+1; end;

End; }

   function pprost(k:longint):boolean;  var i,j,s:longint; t:double; fl:boolean;
begin
  t:=sqrt(k); fl:=true;
   s:=round(t);
    for i:=2 to s do if k mod i=0 then fl:=false;
  pprost:=fl;

end;

  function nok(a,b,c:int64):int64; var k,p,t:int64;
begin
   k:=a*b div nod(a,b);
   p:=c*k div nod(c,k);
 nok:=p;
end;

begin
{assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
}      read(n);
        if n<202  then
          begin
             for i:=1 to n do for j:=i to n do for k:=j to n do
               if nok(i,j,k)>imax then begin imax:=nok(i,j,k); a:=i;b:=j; c:=k;  end;
            writeln(imax); goto 1;
          end;
        if odd(n) then begin  writeln(n*(n-1)*(n-2)); goto 1;     end;
      p:=n*(n-1);
      k:=n-1;
      for i:=n downto n-100 do for j:=i-1 downto (n-100) do for k:=j-1 downto (n-100) do
    begin
       t1:=i;t2:=j;t3:=k;
       s:=nok(t1,t2,t3);
       if s>t then begin  a:=t1;b:=t2; c:=t3; t:=s;      end;

    end;
    {
      repeat dec(k); if nok(n,n-1,k)>imax then imax:=nok(n,n-1,k);
      until pprost(k)or(k<n-50);
      writeln(max((n-1)*(n-2)*(n-3),imax));
   }
      writeln(t{,' ',a,' ', b,' ',c});

     1: close (output);
     end.

var  n,max:int64;
begin
readln(n);
if n<3 then begin write(n); halt; end;
if odd(n) then max:=n*(n-1)*(n-2) else begin
if n mod 3=0 then max:=(n-2)*(n-1)*(n-3) else max:=n*(n-1)*(n-3);
if (n*(n-1)*(n-2) div 2>max)then  max:=n*(n-1)*(n-2) div 2;
end;
write(max);
end.

uses math;
const
        nmax    =       100;
var
        m:longint;
        n,res:int64;
function UCLN(u,v:int64):int64;
begin
        if v=0 then exit(u) else exit(UCLN(v,u mod v));
end;
procedure nhap;
var i,j,t:longint;
u,v:int64;
begin
        read(n);
        if (n=1) then writeln(1)
        else if n=2 then writeln(2)
        else if n=3 then writeln(6)
        else
          begin
        res:=0;
        for i:=max(1,n-70) to n do for j:=max(1,n-70) to n do for t:=max(1,n-70) to n do
          begin
            u:=(int64(i)*j)div UCLN(i,j);
            v:=(u*t)div UCLN(u,t);
            res:=max(res,v);
          end;
          writeln(res);
          end;
end;
procedure xuly;
var i,j,t,res1,res2,res3:longint;
u,v:int64;
begin
        res:=0;
        for i:=1 to n do for j:=1 to n do for t:=1 to n do
          begin
            u:=(i*j)div UCLN(i,j);
            v:=(u*t)div UCLN(u,t);
            if res<v then
              begin
                res:=v;res1:=i;res2:=j;res3:=t;
              end;
          end;
        writeln(n,' ',res,' ',res1,' ',res2,' ',res3);
end;
procedure make;
begin
        assign(output,'a.inp');rewrite(output);
        randomize;
          writeln(random(100)+1);
        close(output);
end;
begin
     //   make;
        assign(input,'');reset(input);
        assign(output,'');rewrite(output);
          nhap;
      //    xuly;
        close(input);
        close(output);
end.

var n,q1,q2,q3:int64;
function tt (a,b:int64):int64;
 begin
  while (a>0) and (b>0) do
   if a>b then a:=a mod b
          else b:=b mod a;
  tt:=a+b;
 end;
 begin
  read (n);
  if n<3 then writeln (n)
         else if n mod 2=1 then writeln (n*(n-1)*(n-2))
         else if n mod 6=0 then writeln ((n-1)*(n-2)*(n-3))
         else begin
               q1:=n;
               q2:=n-1;
               q3:=n-2;
               while q3>(n-2) div 2 do
                begin
                 if (tt(q3,q1)=1) and (tt(q2,q3)=1) then begin
                                                          writeln (q1*q2*q3);
                                                          halt(0);
                                                         end;
                 dec (q3);
                end;
               writeln ((n div 2)*(n-1)*(n-2));
              end;
 end.

Var
        n       :int64;
        i       :longint;
        kq,x    :int64;
        j,k     :longint;
        hh      :longint;

Function UCLN(a,b:int64):int64;
var
        r       :int64;
begin
        While b>0 do
          begin
            r:=a mod b;
            a:=b;
            b:=r;
          end;
        exit(a);
end;

Function BCNN(a,b,c:int64):int64;
var
        x       :int64;
begin
        x:=(a*b) div UCLN(a,b);
        BCNN:=(x*c) div UCLN(x,c);
end;

begin
        read(n);
          begin
                kq:=0;
                for i:=n downto n-100 do
                  for j:=n downto n-100 do
                    for k:=n downto n-100 do
                      if (i>0) and (j>0) and (k>0) then
                      begin
                        x:=BCNN(i,j,k);
                        if x>kq then kq:=x;
                      end;
                  write(kq);
          end;
end.

program lcm;
var
     n:longint;

procedure openf;
begin
     assign(input,'input.txt'); reset(input);
     assign(output,'output.txt'); rewrite(output);
end;

procedure closef;
begin
     close(input); close(output);
end;

function max(x,y:longint):longint;
begin
     if x>=y then exit(x) else exit(y);
end;

function gcd(x,y:int64):int64;
var  t:int64;
begin
     while y<>0 do
     begin
          t:=x mod y;
          x:=y;
          y:=t;
     end;
     gcd:=x;
end;

function cal:int64;
var  tmp,x,y:int64; i,j,k:longint;
begin
     tmp:=0;
     for i:=n downto max(1,n-50) do
       for j:=i-1 downto max(1,n-50) do
          for k:=j-1 downto max(1,n-50) do
          begin
               x:=gcd(i,j); y:=int64(i)*j div x;
               x:=gcd(y,k); y:=y*k div x;
               if y>tmp then tmp:=y;
          end;
     cal:=tmp;
end;

begin

     readln(n);
     case n of
       1:writeln(1);
       2:writeln(2);
       3:writeln(6);
       else
       begin
            if odd(n) then writeln( int64(n)*(n-1)*(n-2) )
               else writeln( cal );
       end;
     end;

end.

var a,b,c,x,n,y,aa,bb,cc:int64;
 begin
  read(n);
  if n=1 then writeln(1)
  else
  if n mod 2=1 then writeln(n*(n-1)*(n-2))
  else
  if n=2 then writeln(2)
  else
  if n mod 3=0 then writeln((n-1)*(n-2)*(n-3))
               else writeln(n*(n-1)*(n-3));
 end.

uses math;
Var i,j,u,n,k:longint;
ans:int64;
  a:array[0..1000333]of longint;
  b:array[0..1003333]of boolean;
 function gcd(x,y:int64):int64;
   begin
     while (x>0)and(y>0) do
       if x>y then x:=x mod y
       else y:=y mod x;
     gcd:=x+Y;
   end;
function lcm(x,y:int64):int64;
  begin
    lcm:=x*y div gcd(x,y);
  end;
  begin
    read(n);
{    fillchar(b,sizeof(b),true);
    b[1]:=false;
    for i:=2 to n do
      if b[i] then
        begin
          inc(k);
          a[k]:=i;
          for j:=2 to n div i do
            b[j*i]:=false;
        end;
    if k>=3 then
      begin
        Writeln(a[k]*a[k-1]*a[k-2]);
        halt(0);
      end;           }
    for i:=n downto max(n-150,1) do
      for j:=i downto max(i-150,1) do
        for u:=j downto max(j-150,1) do
           ans:=max(lcm(lcm(i,j),u),ans);
        Writeln(ans);
  end.

program task_c;

var n,a,i,j,k:longint;
    t,s:int64;

function nok2(a,b:int64):int64;
var x,y:int64;
begin
x:=a;
y:=b;
while (x>0) and (y>0) do
      begin
      if x>y
         then x:=x mod y
         else y:=y mod x;
      end;
nok2:=(a div (x+y))*b;
end;

function nok(a,b,c:int64):int64;
begin
nok:=nok2(nok2(a,b),c);
end;

begin
readln(n);
if n<=6
   then begin
        a:=1;
        end
   else begin
        a:=n-6;
        end;
s:=n;
for i:=a to n do
  for j:=a to n do
    for k:=a to n do
        begin
        t:=nok(i,j,k);
        if t>s
           then s:=t;
        end;
writeln(s);
end.

var n,ans:int64;
begin
  readln(n);
  ans:=0;
  if n=1 then ans:=1 else
  if n=2 then ans:=2 else
  if n mod 2=1 then ans:=n*(n-1)*(n-2) else
  if n mod 3<>0 then ans:=n*(n-1)*(n-3) else
  ans:=(n-1)*(n-2)*(n-3);
  writeln(ans);
end.

{$mode objfpc}
function max(a,b: int64): int64;
begin
  if a>b then max:=a else max:=b;
end;
var
  n: int64;
function ucln(a,b: int64): INT64;
var
  r: int64;
begin
  while b>0 do
    begin
      r:=a mod b;
      a:=b;
      b:=r;
    end;
  result:=a;
end;
function bcnn(i,j,k: int64): int64;
var
  i1,j1,k1,t2,t3,t4: int64;
begin
  i1:=i;
  j1:=j;
  k1:=k;
  t2:=ucln(i1,j1);
  t3:=i1*j1 div t2;
  t4:=ucln(t3,k1);
  result:=t3*k1 div t4;
end;
function tim: int64;
var
 t,t1,i1: int64;
 i,j,k: integer;
begin
  t:=0;
  readln(n);
  if n=1 then exit(1);
  if n=2 then exit(2);
  if n mod 2=1 then exit(n*(n-1)*(n-2));
  for i:=n-2 downto 1 do
    begin
      i1:=i;
      t1:=bcnn(i1,n,n-1);
      t:=max(t,t1);
    end;
  result:=max(t,(n-1)*(n-2)*(n-3));
end;
begin
  writeln(tim);
end.

const fi=''; fo='';
function ucln(a,b:int64):int64;
var tmp:int64;
begin
    while b>0 do
    begin
        a:=a mod b;
        tmp:=a; a:=b; b:=tmp;
    end;
    exit(a);
end;
procedure process;
var n,max,d,t,h:int64; i,j,k:longint;
begin
    readln(n); max:=0;
    if n=1 then writeln(1)
    else if n=2 then writeln(2)
    else if n=3 then writeln(6)
    else begin
    for i:=0 to 3 do
    for j:=i+1 to 3 do
    for k:=j+1 to 3 do
    begin
        t:=ucln(n-i,n-j); d:=((n-i)*(n-j))div t;
        h:=ucln(d,n-k);
        d:=(d*(n-k))div h;
        if d>max then max:=d;
    end;
    writeln(max);
    end;
end;
begin process; end.

VAR
 a,n:int64;
 begin
  readln(n);
  if n=1 then
   begin
    writeln('1');
    exit;
  end;
 if n=2 then
  begin
   writeln('2');
   exit;
  end;
 if n mod 2=1 then a:=n*(n-1)*(n-2)
 else if n mod 3=0 then a:=(n-1)*(n-2)*(n-3)
 else a:=n*(n-1)*(n-3);
 writeln(a);
end.

var
  a, b, c, i: int64;

function gcd(a, b: int64): int64;
begin
  if a = 0 then begin
    gcd := b;
    exit;
  end;
  gcd := gcd(b mod a, a);
end;

begin
  readln(a);
  if a < 3 then begin
    writeln(a);
    halt();
  end;
  b := a * (a - 1);
  c := b;
  i := a - 2;
  while i > 0 do begin
    if b * i div gcd(i, b) > c then c := b * i div gcd(i, b);
    dec(i);
  end;
  a := a - (1 - a mod 2);
  if c > a * (a - 1) * (a - 2) then writeln(c)
  else writeln(a * (a - 1) * (a - 2));
end.

program form;
var n: int64;

begin
{assign (input, 'input.txt');
reset (input);
assign (output, 'output.txt');
rewrite (output);}
read (n);
if n=1 then begin writeln (1); halt; end;
if n=2 then begin writeln (2); halt; end;
if n=3 then begin writeln (6); halt; end;
if n=4 then begin writeln (12); halt; end;
if n=5 then begin writeln (60); halt; end;
if n=6 then begin writeln (60); halt; end;
if n mod 2 = 1 then
 begin writeln (n*(n-1)*(n-2)); halt; end;
if n mod 3 =0 then
 begin writeln ((n-3)*(n-1)*(n-2));halt; end;
writeln ((n-3)*(n-1)*(n));
halt;
end.

{$APPTYPE CONSOLE}
{$O-}
{$R+}

uses
  SysUtils, Math;

var
  p: array[1..1005000] of integer;
  i, j, k, c: integer;
  mx, n, f: int64;

function smp(n: integer): boolean;
var
  i: integer;
begin
  smp := true;
  for i := 2 to trunc(sqrt(n)) do
    if n mod i = 0 then begin
      smp := false;
      exit;
    end;
end;

function nok(a, b: int64): int64;
var
  x, y: int64;
begin
  x := a;
  y := b;
  while (a <> 0) and (b <> 0) do
    if a > b then
      a := a mod b
    else
      b := b mod a;
  nok := int64(x * y) div (a + b);
end;

begin
  //reset(input, 'input.txt');
  //rewrite(output, 'output.txt');
  read(n);
  fillchar(p, sizeof(p), 0);
{  for i := n downto max(n - 1000, 2) do
    if smp(i) then
      p[i] := 1;}
  mx := nok(nok(n, n), n);
  for i := n downto max(n - 50, 1) do
    for j := n downto max(n - 50, 1) do
      for k := n downto max(n - 50, 1) do begin
        f := nok(nok(i, j), k);
        if f > mx then
          mx := f;
//        if p[k] = 1 then break;
      end;
  write(mx);

end.

Var n:LongInt;
Begin
    // ReSet (input,'input.txt');
    // ReWrite (output,'output.txt');
     Readln (n);
     If n<3
     then Writeln (n)
     else If n mod 2=1
          then Writeln (n*(n-1)*(n-2))
          else If n mod 3=0
               then Writeln ((n-1)*(n-2)*(n-3))
               else Writeln (n*(n-1)*(n-3))
end.

uses math;
const
 pi=3.1415926535;
var
 f,ff:array[0..100,0..100] of longint;
 a,b:array[0..210000] of longint;
//  b:array[1..100] of longint;

 x,y,k,l,i,j,z,col,r,jj,m,t,ans:longint;
 st,stt:array[0..50100] of string;
 p:array[1..50000] of boolean;
 s,ss,sw:ansistring;
 ch:array['a'..'z'] of longint;
// x,y,xx,yy:extended;
 c:char;
 w:array['a'..'z'] of longint;
 xx,n,ms,tp:int64;
// v,r,s,ss,k,t,al:extended;

function nod(a,b:longint):longint;
begin
  while int64(a)*b>0 do
   if a>b then a:=a mod b else b:=b mod a;
  nod:=a+b;

end;

begin
//ssign(input,'input.txt');reset(input);
//assign(output,'output.txt');rewrite(output);
 read(n);
 if n=1 then write(1) else if n=2 then write(2) else
// for i:=n downto 1 do
//  if pr(i) then break;
 tp:=n*(n-1) div (nod(n,n-1));
 tp:=tp*(n-2) div( nod(tp,n-2));

 write(tp);

end.

const fin='';
     fout='';
var  n:longint; s,k,i,j:int64;
     f,g:text;
function ucln(a,b:longint):longint;
var tmp:longint;
begin
     while b>0 do
          begin
          a:=a mod b;
          tmp:=a; a:=b; b:=tmp;
          end;
     exit(a);
end;
begin
     assign(f,fin);reset(f);
     assign(g,fout);rewrite(g);
     read(f,n);
     i:=n;
     if n>=5 then
     while i>1 do
          begin
               j:=i;
               while j>1 do
               begin
               if ucln(i,j)=1 then
                    begin
                    k:=j;
                    while k>1 do
                    begin
                    if (ucln(k,j)=1) and (ucln(k,i)=1) then
                         begin
                         s:=(i*j*k);
                         write(g,s);
                         close(g); exit;
                         end;
                    dec(k);
                    end;
                    end;
               dec(j);
               end;
          dec(i);
          end
     else
          begin
          if n=1 then write(g,1);
          if n=2 then write(g,2);
          if n=3 then write(g,6);
          if n=4 then write(g,12);
          end;
     close(g);
end.

var
  a,b,c,n:int64;
begin
  readln(n);
  if odd(n)
    then begin writeln(n*(n-1)*(n-2));halt;end;
  if n mod 3<>0
    then writeln(n*(n-1)*(n-3))
    else writeln((n-1)*(n-2)*(n-3))
end.

var
 i,n:longint;
 l,lmax,a,b,lold:int64;

procedure Swap(var a,b:int64);
 var p:int64;
  begin
   p:=a;
   a:=b;
   b:=p;
  end;

function GCD(a,b:int64):int64;
 begin
 while b>0 do
   begin
    a:=a mod b;
    Swap(a,b);
   end;
  GCD:=a;
 end;

function LCM(a,b:int64):int64;
 begin
  LCM:=(a*b) div GCD(a,b);
 end;

begin
 readln(n);
 lmax:=LCM(n,n-1);
 l:=lmax;
 lold:=lmax;
 for i:=2 to n do
  begin
   b:=i;
   l:=LCM(lold,b);
   if l>lmax then lmax:=l;
  end;
 writeln(lmax);
end.

uses
  SysUtils,math;
var i,j,k,n : integer;
r ,ans : int64;
function gcd(a,b : integer) : integer;
begin
 if (a = 0) then gcd:=b
 else
  gcd:=gcd(b mod a,a);
end;
begin
 readln(n);
 ans := 0;
 for i:=n downto max(1,n-100) do
  for j:=n downto max(1,n-100) do
   for k:=n downto max(1,n-100) do
   begin
    r := i*j div gcd(i,j);
    r := r*k div gcd(r,k);
    if (r > ans) then ans := r;
   end;
  writeln(ans);
end.

uses math;
var n: int64;
function gcd(x, y: int64): int64;
begin
        if y = 0 then
                exit(x)
        else
                exit(gcd(y, x mod y));
end;
begin
        readln(n);
        if n < 3 then
                writeln(n)

                else if n mod 2 = 1 then
                writeln(n * (n - 1) * (n - 2))
        else writeln(max(n * (n - 1) * (n - 2) / 2, max((n - 1) * (n - 2) * (n - 3), n * (n - 1) * (n - 3) / gcd(n, n - 3) / gcd(n - 1, n - 3))):0:0);
end.

uses math;
const fin='';
var f:text;
     n:longint;
     s:qword;
function bcnn(a,b:longint):int64;
var x,y,du:longint;
begin
     x:=a; y:=b;
     repeat
          du:=x mod y;
          x:=y; y:=du;
     until du=0;
     bcnn:=a div x*b;
end;
begin
     assign(f,fin); reset(f);
     read(f,n);
     if (n=1) or (n=2) then write(n)
     else
          begin
               s:=n*(n-1);
               s:=max(bcnn(s,(n-2)),bcnn(s,(n-3)));
               write(s);
          end;
end.

var a,b,c,q:integer;
begin
 read(a);
 b:=a-1;
 c:=a-2;
 q:=a*b*c;
 write (q);
end.

Var
        n       :int64;
        i       :longint;
        kq,x    :int64;

Function UCLN(a,b:int64):int64;
var
        r       :int64;
begin
        While b<>0 do
          begin
            r:=a mod b;
            a:=b;
            b:=r;
          end;
        exit(a);
end;

Function BCNN(a,b,c:int64):int64;
var
        x       :int64;
begin
        x:=(a*b) div UCLN(a,b);
        BCNN:=(x*c) div UCLN(x,c);
end;

begin
        read(n);
        if n=2 then write(2);
        if n=3 then write(6);
        if n=4 then write(12);
        if n>4 then
          begin
            if n mod 2=1 then write(n*(n-1)*(n-2))
              else
                begin
                  kq:=(n-1)*(n-2)*(n-3);
                  for i:=n-2 downto n-5 do
                    begin
                      if i<1 then continue;
                      x:=BCNN(n,n-1,i);
                      if x>kq then kq:=x;
                    end;
                  for i:=n-3 downto n-5 do
                    begin
                      if i<1 then continue;
                      x:=BCNN(n,n-3,i);
                      if x>kq then kq:=x;
                    end;
                  write(kq);
                end;
          end;
end.

program A146;
const
        inp='';
        oup='';
var
        N:longint;
        Res:int64;
        i,j,k:longint;

function UCLN(A,B:longint):int64;
begin
        if b=0 then exit(A);
        exit(UCLN(B, A mod B));
end;

function Get(X,Y,Z:int64):int64;
var     Cres:int64;
begin
        Cres:=(X*Y) div UCLN(X,Y);
        CreS:=(Cres*Z) div UCLN(Cres,Z);
        exit(Cres);
end;

begin
        readln(N);
        if N=1 then writeln(1);
        if N=2 then writeln(2);
        if n>=3 then
                begin
                        for i:=N downto N-100 do
                                for j:=i-1 downto N-100 do
                                        for k:=j-1 downto N-100 do
                                                if (i>0) and (j>0) and (k>0) then
                                                begin
                                                        if Res<Get(i,j,k) then Res:=Get(i,j,k);
                                                end;
                        writeln(Res);
                end;
end.

{
    contest 146 div 2: problem C
}
var n: longint;
    lcm, a, b, c: int64;

begin
    readln(n);
    if (n < 3) then lcm := n
    else if (n mod 2 = 1) then
        lcm := n*(n-1)*(n-2)
    else if (n mod 3 = 0) then
        lcm := (n-1)*(n-2)*(n-3)
    else lcm := n*(n-1)*(n-3);
    write(lcm);
end.

const   fi      =       '';
        fo      =       '';
var     n       :       longint;

{}
Procedure motep;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);
end;

{}
Procedure dongtep;
begin
  close(input); close(output);
end;

{}
Procedure solve;
begin
  read(n);
  if n = 1 then write(1)
  else if n = 2 then write(2)
       else if n mod 2 <> 0 then write(n*(n-1)*(n-2))
            else if n mod 3 = 0 then write((n-1)*(n-2)*(n-3))
                 else write(n*(n-1)*(n-3));
end;

BEGIN
  motep;
  solve;
  dongtep;
END.

const fin='';
var f:text;
     s:qword;
     n:longint;
begin
     assign(f,fin); reset(f);
     read(f,n);
     if (n=1) or (n=2) then write(n)
     else
          begin
               if n mod 2=1 then s:=n*(n-1)*(n-2)
               else
                    if n mod 3=0 then s:=(n-1)*(n-2)*(n-3)
                    else s:=n*(n-2)*(n-3);
               write(s);
          end;
end.

Var
        n       :int64;
        i       :longint;
        kq,x    :int64;

Function UCLN(a,b:int64):int64;
var
        r       :int64;
begin
        While b<>0 do
          begin
            r:=a mod b;
            a:=b;
            b:=r;
          end;
        exit(a);
end;

Function BCNN(a,b,c:int64):int64;
var
        x       :int64;
begin
        x:=UCLN(a,c)*UCLN(a,b)*UCLN(b,c);
        BCNN:=(a*b*c) div x;
end;

begin
        read(n);
        if n=2 then write(2);
        if n=3 then write(6);
        if n=4 then write(12);
        if n>4 then
          begin
            if n mod 2=1 then write(n*(n-1)*(n-2))
              else
                begin
                  kq:=(n-1)*(n-2)*(n-3);
                  for i:=n-2 downto 1 do
                    begin
                      x:=BCNN(n,n-1,i);
                      if x>kq then kq:=x;
                    end;
                  write(kq);
                end;
          end;
end.

var
  n,w,max : int64;
  i,j : longint;
  function gcd(x,y : int64) : int64;
   begin
    while (x<>0) and (y<>0) do
     begin
      if x>y then x:=x mod y
      else y:=y mod x;
     end;
    gcd:=x+y;
   end;
begin
  readln(n);
  if n<3 then begin writeln(n); exit; end;
  for i:=1 to n-2 do
   begin
    w:=(i*n) div gcd(i,n);
    w:=(w*(n-1)) div gcd(w,(n-1));
    if w>max then max:=w;
   end;
   writeln(max);
end.

var a:array[1..100000] of boolean;
var b:array[0..100000] of longint;
var i,j:longint;
var n:int64;
begin

        readln(n);
        for i:=2 to trunc(sqrt(n)) do
        if not a[i] then
        for j:=2 to n div i do a[i*j]:=true;
        for i:=2 to n do if not a[i] then
        begin
                b[0]:=b[0]+1;
                b[b[0]]:=i;
        end;
        if n=1 then write(1)
        else if n=2 then write(2)
        else
        for i:=2 to n do if n mod b[i]>0 then
        begin
                if n*(n-1)*(n-b[i])>(n-1)*(n-2)*(n-3) then
                write(n*(n-1)*(n-b[i]))
                else write((n-1)*(n-2)*(n-3));
                break;
        end;

end.

var  i, j, x, n, nod, lcm_r, max, q, y, z: int64;

function gcd(a, b: longint):int64;
begin
if b=0 then gcd:=a else gcd:=gcd(b,a mod b);
end;

begin
readln(n);
if n=1 then begin writeln('1'); halt; end;
if n=2 then begin writeln('2'); halt; end;
if n div 2 <>0 then n:=n-1;

    writeln(n*(n-1)*(n-2));
end.

program adsf;
var
i,j,n:longint;
ans,c,b:qword;
 function gcd(a,b:qword):qword;
         begin
         if a mod b=0 then exit(b);
         exit(gcd(b, a mod b));
         end;
begin
readln(n);b:=0; if n=1 then begin
writeln(1);halt;end;if n=2 then begin writeln(2);halt;end;
if n=3 then begin writeln(6);halt;end;    i:=n-1;j:=n-2;
c:=i*j div gcd(i,j);
b:=i*n div gcd(i,n);
if c>b then
begin
    for i:=n downto 1 do begin
    if (gcd(i,n-1)=1 )and(gcd(i,n-2)=1) then
    begin
    writeln(i*c);halt;end;  end;
end
else          begin
for i:=n-2 downto 1 do begin
if (gcd(i,n)=1)and(gcd(i,n-1)=1) then begin
writeln(i*b);halt;end;
end;
                   end;

end.

const   fi      =       '';
        fo      =       '';
var     n       :       Int64;

{}
Procedure motep;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);
end;

{}
Procedure dongtep;
begin
  close(input); close(output);
end;

{}
Procedure solve;
begin
  read(n);
  write(n*(n-1)*(n-2));
end;

BEGIN
  motep;
  solve;
  dongtep;
END.

var
i,j,ans,k,n,cool :longint;
d:array[0..1111111] of longint;

function Check(x:longint):boolean;
var j:longint;
begin
j:=2;
while(j*j<=x) do
 begin
 if x mod j = 0 then
  begin
  Check:=false;
  exit;
  end;
 if j = 2 then Inc(j)
 else Inc(j,2);
 end;
Check:=true;
end;

function go:longint;
var l,best:int64;j,q,w,z:longint;
begin
l:=1;
for j:=n downto 2 do
 begin
  if Check(j) then
   begin
   if l * j > n then break;
   cool:=j-1;
   //d[j]:=1
   l:=l*j;
   end;
 end;
{for j:=f[0] downto 1 do
 begin
 q:=l;w:=0;
 while(q*f[j]<=n) do
  begin
  q:=q*f[j];
  Inc(w);
  end;
 if w > g[j] then
  begin
  for q:=1 to w-g[j] do l:=l*f[j];
  g[j]:=w;
  end;
 end;
best:=l;}
go:=l;
end;

begin
//Assign(input,'input.txt');Reset(input);
// Assign(output,'output.txt');Rewrite(output);
Readln(n);
ans:=1;cool:=n;
for i:=1 to 3 do
 ans:=ans*go;
Writeln(ans);
//Close(input);Close(output);
end.

var n: LongInt;
x: Int64;
begin
  Readln(n);
  if n<3 then x:=n else if odd(n) then x:=n*(n-1)*(n-2) else if n mod 3=0 then x:=(n-1)*(n-2)*(n-3) else x:=n*(n-1)*(n-3);
  Writeln(x);
end.

program C236;
var n: integer;
begin
readln(n);
if n = 1 then writeln(1)
else if n = 2 then writeln(2)
else if n = 3 then writeln(6)
else if n = 4 then writeln(6)
else if n = 5 then writeln(60)
else if n =  6 then writeln(60)
else if (n mod 2 = 1) then writeln(n*(n-1)*(n-2))
else
 begin
  if (n mod 3 <> 0) then writeln(n*(n-1)*(n-3))
  else writeln((n-1)*(n-2)*(n-3));
 end;
end.

program A146;
const
        inp='';
        oup='';
var
        N:longint;
        Res:int64;

begin
        readln(N);
        if N=1 then writeln(1);
        if N=2 then writeln(2);
        if n>=3 then
        if N mod 2 = 1 then
                begin
                        writeln(int64(N)*int64(N-1)*int64(N-2));
                end
        else
                begin
                        Res:=(N-1)*(n-2)*(N-3);
                        if  (Res< (N*(N-1)*(N-2)) div 2) then
                                Res:=N*(N-1)*(N-2) div 2;
                        writeln(Res);
                end;
end.

uses math;
var
kk,k:int64;
l,r,x1,y1,nn,inf,x,y,dd,ans,j,v,ss,i,n,m,s:longint;
mark,q,dp,xx,yy,mas2:array[0..100003] of  longint;
a:array[0..4003,0..4000] of  longint;
ch:char;
function gcd(b,a:longint):longint;
begin
{writeln (b,a);}
if a=0 then gcd:=b
else gcd:=gcd(a,b mod a);
end;
begin
readln (n);
if n=1 then begin writeln (1);halt end else
if n=2 then begin writeln (2);halt end else
if n=3 then begin writeln (6);halt end;
if n=4 then begin writeln (12);halt end;

i:=n-1;
for i:=max(1,n-100) to n-2 do
  begin
  kk:=(i+1) div gcd(i+1,i+2)*(i+2);
  k:=max (k, i div gcd(i,kk)*kk   );
  end;

writeln (k);
END.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Math;

var
  a, b, c, d, e: int64;
  i: integer;

function NOD(x, y: int64): int64;
begin
  if x <> 0 then
    NOD := NOD(y mod x, x)
  else
    NOD := y;
end;

function NOK(x, y: int64): int64;
begin
  NOK := (x div NOD(x, y)) * y;
end;

begin

  {assign(input, 'input.txt');
  reset(input);
  assign(output, 'output.txt');
  rewrite(output);}

  read(a);
  if a = 3 then
    write('6')
  else
    if a = 2 then
      write('2')
    else if a = 1 then
      write('1')
    else
    begin
      b := a * (a - 1);
      d := b;
      for i := 1 to a do
      begin
        e := i;
        c := NOK(e, b);
        d := max(d, c);
      end;
      b := a * (a - 3);
      d := b;
      for i := a - 4 to a do
      begin
        e := i;
        c := NOK(e, b);
        d := max(d, c);
      end;

      write(d);
    end
end.

var n,k,d:longint;
 begin
  readln(n);
  if n<3 then begin
          if n=2 then writeln(2)
                 else writeln(1);
                 exit;
              end;
  if n mod 2=0 then k:=2
               else k:=1;
  if n mod 2<>0 then d:=2 else d:=1;
  if n*(n-1)*(n-2) div k >(n-2)*(n-1)*(n-3) div d then writeln(n*(n-1)*(n-2) div k)
                                                  else writeln((n-2)*(n-1)*(n-3) div d);
 end.

var  n,max:int64;
begin
readln(n);
if odd(n) then max:=n*(n-1)*(n-2) else begin
if n mod 3=0 then max:=(n-2)*(n-1)*(n-3) else max:=n*(n-1)*(n-3);
if (n*(n-1)*(n-2) div 2>max)then  max:=n*(n-1)*(n-2) div 2;
end;
write(max);
end.

Program ProblemC;
type
PrimeArray = array [1..1000000] of boolean;
var
Prime : PrimeArray;
i, j, idx : longint;
IsPrime : boolean;
n, results, l, temp : int64;
begin
readln(n); //reading input
if n = 1 then results := 1;
if n = 2 then results := 2;
if n = 3 then results := 6;
if n = 4 then results := 12;
if n = 5 then results := 60;
if n = 6 then results := 60;
if n > 6 then
begin
//generate prime
 for i := 1 to 1000000 do
   begin
      Prime[i] := true;
   end;
 Prime[1] := false;
 idx := 2;
 repeat
 if Prime[idx] = true then
   begin
     for i := 2 to (1000000 div idx) do
       begin
          Prime[i*idx] := false;
       end;
   end;
   inc(idx);
 until (idx = 1000000);
 if (n mod 2) = 0 then
 begin
 for i := (n-2) downto 2 do
   begin
      if Prime[i] then
       begin
           l := i;
           break;
       end;
   end;
 results := n * (n-1) * l;
 temp := (n-1) * (n-2) * (n-3);
 if temp > results then results := temp;
 end else results := n * (n-1) * (n-2);
end;
writeln(results);
end.

function nod(a,b:int64):int64;
  var c:int64;
  begin
    if b>a then begin
    c:=a; a:=b; b:=c;
    end;
    while (a mod b) <> 0 do
      begin
        c:=a mod b;
        a:=b;
        b:=c;
      end;
      nod:=b;
end;
function zxc(n,p,nok:longint):longint;
var i,j,no:integer;
begin
for j:=n downto p do begin
for i:=n-2 downto p do
      begin
       if nok<((j*(j-1)*i)div nod(j*(j-1),i)) then begin
       nok:=(j*(j-1)*i)div nod(j*(j-1),i); no:=nod(j*(j-1),i);
       zxc:=nok;
       end;
end;
end;
end;
var nok,no,n,m,p,p2,k,i,j:longint;

begin
   nok:=0;
  read(n);

  for i:=n-1
  downto 1 do
  begin
    m:=0;
    j:=2;
    while j<=(sqrt(i)+1) do
    begin
      if (i mod j) = 0 then m:=1;
      j:=j+1;
    end;
    if m=0 then begin p:=i; break; end;

  end;
  if p=n-1 then begin
     for i:=n-2 downto 1 do
     begin
     m:=0;
     j:=2;
     while j<=(sqrt(i)+1) do
     begin
      if (i mod j) = 0 then m:=1;
      j:=j+1;
     end;
     if m=0 then begin p2:=i; break; end;

    end;
  end;

  if n=1 then write(1)
  else if n=2 then write(2)
  else if n=3 then write(6)
  else if p = n-1 then
    begin
    write(zxc(n,p2,nok));
    end
  else if p = n - 2 then
    begin
    writeln(n*p*(n-1));
    end
  else
    begin
      write(zxc(n,p,nok));
      end;
end.

{$apptype console}
{$I+,R+,Q+}
Uses
  SysUtils;
Var
  noko:int64;
  a,b,n:int64;

Function Nod(a,b:int64):int64;
Begin
  if b=0 then begin
    result:=a;
    exit;
  end;
  result:=nod(b,a mod b);
end;

Procedure nok;
Begin
  noko:=a*n div nod(a,n);
  noko:=noko*b div nod(noko,b);
End;
Var
  i  :  integer;
Begin
  readln(n);
  for i:=n downto 1 do
    if nod(n,i)=1 then begin
      a:=i;
      break;
    end;
  for i:=a downto 1 do
    if (nod(a,i)=1)and(nod(n,i)=1) then begin
      b:=i;
      break;
    end;
  nok;
  writeln(noko);

End.

var i,j,k,l,m,n:longint;
    nok0,t:int64;
function nod(a,b:longint):longint;
var x,y:longint;
begin
 x:=a;
 y:=b;
 while (x>0)and(y>0) do
   if x>y then x:=x mod y else y:=y mod x;
 nod:=x+y;
end;

function nok(a,b,c:longint):int64;
var p,p1,p2,p3:longint;
begin
 p1:=nod(b,c);
 p2:=nod(a,c);
 p3:=nod(a,b);
 p:=nod(a,p1);

 nok:=a*b*c div p1 div p2 div p3*p;

 end;

begin
 read(n);
 if n>50 then i:=n-50 else i:=1;
while (i<=n)do
    begin
     j:=i;
     l:=i;
     while (l<=n)and(j<=n) do
       begin
           t:=nok(i,j,l);
           IF t>nok0 then nok0:=t;

           inc(l);

           if l>n then begin
             j:=j+1;
             l:=j;
                       end;
       end;

     inc(i);
    end;
  write(nok0);
end.

{$MODE OBJFPC}
Var
  n:Integer;
  Res:Int64;

Begin
  Readln(n);
  If N mod 2=0 then Dec(n);
  Res:=n*(n-1)*(n-2);
  Writeln(res);
End.

const   fi      =       '';
        fo      =       '';
var     n       :       Int64;

{}
Procedure motep;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);
end;

{}
Procedure dongtep;
begin
  close(input); close(output);
end;

{}
Procedure solve;
begin
  read(n);
  if n = 1 then write(1)
  else if n = 2 then write(2)
       else write(n*(n-1)*(n-2));
end;

BEGIN
  motep;
  solve;
  dongtep;
END.

var     n, tmp: int64;

Function Max(a, b: int64): int64;
begin
        if a < b then exit(a) else exit(b);
end;

Begin
        read(n);
        if n = 1 then write(1);
        if n = 2 then write(2);
        if n = 3 then write(6);
        if n = 4 then write(12);
        if n <= 4 then exit;
        if odd(n) then write(n*(n-1)*(n-2))
        else
                begin
                        tmp := max((n-1)*(n-2)*(n-3), n*(n-1)*(n-2) div 2);
                        if n mod 3 = 0 then tmp := Max(tmp, n*(n-1)*(n-3) div 3)
                        else
                                tmp := max(tmp, n*(n-1)*(n-3));
                write(tmp);
                end;
end.

{$MODE OBJFPC}
Var
  n:Int64;
  Res:Int64;

Begin
  Readln(n);
  If N mod 2=0 then
    Begin
      If (n-1)*(n-2)*n div 2<(n-2)*(n-1)*(n-3) then
        Res:=(n-2)*(n-1)*(n-3) Else
          Res:=(n-1)*n*(n-2) div 2;
      Writeln(Res);
      Halt;
    End;
  Res:=n*(n-1)*(n-2);
  Writeln(res);
End.

uses math;
type mass=array[1..1000000] of int64;
var r,l,a,z,i,c,k,b,j:integer;s,s1:string;u:boolean;n,res,de:int64;m:mass;
begin
 // reset(input,'input.txt');
 // assign(output,'output.txt');
  readln(n);
  if n=1
  then writeln(1)
  else if n<4
       then writeln((n-1)*n)
       else if n mod 2=1
            then writeln((n-1)*(n-2)*n)
            else writeln((n-2)*(n-3)*(n-1));
end.

var
    n:int64;
begin
readln(n);
if n=1 then begin write(1); exit; end;
if n=2 then begin write(2); exit; end;
if n mod 2=1 then write(n*(n-1)*(n-2)) else write(n*(n-1)*(n-3));
end.

var
 v,z1,n,g,g1,max:int64;
 i,j,z:longint;
begin
{ assign(input,'a.in');
 reset(input);
 assign(output,'a.out');
 rewrite(output);}
 readln(n);
 for i:=n-100 to n do if i>0 then
 for j:=n-100 to n do if j>0 then
 for z:=n-100 to n do if z>0 then
 begin
  g:=i;
  g1:=j;
  while (g>0)and(g1>0) do
  begin
   if g>g1 then g:=g mod g1
   else g1:=g1 mod g;
  end;
  g:=g+g1;
  v:=(i*j) div g;

  g:=v;
  g1:=z;
  while (g>0)and(g1>0) do
  begin
   if g>g1 then g:=g mod g1
   else g1:=g1 mod g;
  end;
  z1:=(v*z) div (g+g1);
  if z1>max then
  max:=z1;
 end;
 writeln(max);
end.

var
   n:longint;
   s:int64;
begin
   readln(n);
   if n = 1 then s:=1
   else
   if n = 2 then s:=2
   else
   if n = 3 then s:=6
   else
   if n mod 2 = 0 then s:=(n-1)*(n-2)*(n-3)
   else s:=n*(n-1)*(n-2);
   writeln(s);
end.

Program ProblemC;
type
PrimeArray = array [1..1000000] of boolean;
var
Prime : PrimeArray;
i, j, idx : longint;
IsPrime : boolean;
n, results, l : int64;
begin
readln(n); //reading input
if n = 1 then results := 1;
if n = 2 then results := 2;
if n = 3 then results := 6;
if n = 4 then results := 12;
if n = 5 then results := 60;
if n = 6 then results := 60;
if n > 6 then
begin
//generate prime
 for i := 1 to 1000000 do
   begin
      Prime[i] := true;
   end;
 Prime[1] := false;
 idx := 2;
 repeat
 if Prime[idx] = true then
   begin
     for i := 2 to (1000000 div idx) do
       begin
          Prime[i*idx] := false;
       end;
   end;
   inc(idx);
 until (idx = 1000000);
 if not Prime[n] then
 begin
 for i := (n-2) downto 2 do
   begin
      if Prime[i] then
       begin
           l := i;
           break;
       end;
   end;
 results := n * (n-1) * l;
 end else results := n * (n-1) * (n-2);
end;
writeln(results);
end.

var
  a, b, c, i: int64;

function gcd(a, b: int64): int64;
begin
  if a = 0 then begin
    gcd := b;
    exit;
  end;
  gcd := gcd(b mod a, a);
end;

begin
  readln(a);
  if a < 3 then begin
    writeln(a);
    halt();
  end;
  b := a * (a - 1);
  c := b;
  i := a - 2;
  while i > 0 do begin
    if b * i div gcd(i, b) > c then c := b * i div gcd(i, b);
    dec(i);
  end;
  writeln(c);
end.

var i,j,x,n,nod,lcm_r,max:longint;min:array[0..3] of longint;

  function gcd( a, b: longint): longint;
  begin
   while (a <> 0) and (b <> 0) do
     if a >= b then
       a:= a mod b
     else
       b:= b mod a;
   nod:= a + b;
  end;

  procedure lcm (a,b,c:longint) ;
  begin
  gcd (a, b);
    lcm_r:= a*b div nod  ;
    gcd (c, lcm_r);
    lcm_r:= c*lcm_r div nod  ;
end;

begin
min[0]:=n+1;
readln(n);

for i:=n downto 1 do begin
for j:=n downto 1 do begin
for x:=n downto 1 do begin
lcm(i,j,x);
if (lcm_r=i*j*x) then begin writeln(lcm_r);halt;end;
if (lcm_r>max) then  max:=lcm_r;
end;end;end;
writeln(max);
end.

var
     N,Ans,Q,Z:Int64;
     i,j,k:Longint;
function Nod(X,Y:Int64):Int64;
begin
     while (X>0) and (Y>0) do
     if X>Y then X:=X mod Y
            else Y:=Y mod X;
     Nod:=X+Y;
 end;
begin
     Readln(N);
     if N=1 then Writeln('1')
            else
     if N=2 then Writeln('2')
            else
begin
     for i:=N-5 to N do
     for j:=N-5 to N do
     for k:=N-5 to N do
begin
     Q:=i*j div Nod(i,j);
     Z:=Q*k div Nod(i,j);
     if Z>=Ans then Ans:=Z;
 end;
     Writeln(Ans);
 end;
 end.

const fin='';
var f:text;
     s:qword;
     n:longint;
begin
     assign(f,fin); reset(f);
     read(f,n);
     if (n=1) or (n=2) then write(n)
     else
          begin
               if n mod 2=1 then s:=n*(n-1)*(n-2)
               else
                    if n mod 3=0 then s:=(n-1)*(n-2)*(n-3)
                    else s:=n*(n-1)*(n-3);
               write(s);
          end;
end.

program lcm;
var
     n:longint;

procedure openf;
begin
     assign(input,'input.txt'); reset(input);
     assign(output,'output.txt'); rewrite(output);
end;

procedure closef;
begin
     close(input); close(output);
end;

function max(x,y:longint):longint;
begin
     if x>=y then exit(x) else exit(y);
end;

function gcd(x,y:int64):int64;
var  t:int64;
begin
     while y<>0 do
     begin
          t:=x mod y;
          x:=y;
          y:=t;
     end;
     gcd:=x;
end;

function cal:int64;
var  tmp,x,y:int64; i,j,k:longint;
begin
     tmp:=0;
     for i:=n downto max(1,n-50) do
       for j:=i-1 downto max(1,n-50) do
          for k:=j-1 downto max(1,n-50) do
          begin
               x:=gcd(i,j); y:=int64(i)*j div x;
               x:=gcd(y,k); y:=y*k div x;
               if y>tmp then tmp:=y;
          end;
     cal:=tmp;
end;

begin

     readln(n);
     case n of
       1:writeln(1);
       2:writeln(2);
       3:writeln(6);
       else
       begin
            if odd(n) then writeln( n*(n-1)*(n-2) )
               else writeln( cal );
       end;
     end;

end.

function nod(a,b:int64):int64;
begin
while(a<>0)and(b<>0)do
   if a>b then a:=a mod b else b:=b mod a;
if a<>0 then nod:=a else nod:=b;
end;
var c,n,k:int64;
begin
readln(n);
if n=1 then writeln(1)else
  if n=2 then writeln(2)else begin
c:=n*(n-1);
k:=1;
   while(true)do begin
       inc(k);
       if nod(c,n-k)<=nod(c,n-k-1)then break;
   end;
writeln(c*(n-k) div nod(c,n-k));
end;
end.

Var n:LongInt;
Begin
    // ReSet (input,'input.txt');
    // ReWrite (output,'output.txt');
     Readln (n);
     If n<3
     then Writeln (n)
     else If n mod 2=1
          then Writeln (n*(n-1)*(n-2))
          else If n mod 3=0
               then Writeln ((n-1)*(n-2)*(n-3))
               else Writeln (n*(n-1)*(n-3))
end.

var a:array[1..100000] of boolean;
var b:array[0..100000] of longint;
var i,j:longint;
var n:int64;
begin

        readln(n);
        for i:=2 to trunc(sqrt(n)) do
        if not a[i] then
        for j:=2 to n div i do a[i*j]:=true;
        for i:=2 to n do if not a[i] then
        begin
                b[0]:=b[0]+1;
                b[b[0]]:=i;
        end;
        if n=1 then write(1)
        else if n=2 then write(2)
        else
        for i:=2 to n do if n mod b[i]>0 then
        begin
                if n*(n-1)*(n-b[i])>(n-1)*(n-2)*(n-3) then
                write(n*(n-1)*(n-b[i]))
                else write((n-1)*(n-2)*(n-3));
                break;
        end;

end.

uses math;
var a,n,q: integer;
begin
	read(n);
	if (odd(n)) then q:= (n)*(n-1)*(n-2) else q:=(n-3)*(n-1)*(n-2);
	write(q);
end.

Uses Math;
Type tm=Array[1..10000] of LongInt;
Var m:tm;
    n,kol:LongInt;
    x:Int64;

Procedure Prime (l:LongInt);
Var i,j,n:LongInt;
Begin
     m[1]:=2;
     i:=3;
     kol:=1;
     While i<=l do
     Begin
          j:=3;
          n:=Round(sqrt(i))+1;
          While (i mod j<>0) and (j<n) do Inc (j,2);
          If j>=n then Begin Inc (kol); m[kol]:=i End;
          Inc (i,2);
     End;
End;

Begin
   //  ReSet (input,'input.txt');
  //   ReWrite (output,'output.txt');
     Readln (n);
     Case n of
     1:Begin Writeln (1); Halt (0) End;
     2:Begin Writeln (2); Halt (0) End;
     3:Begin Writeln (6); Halt (0) End;
     4:Begin Writeln (12); Halt (0) End;
     5:Begin Writeln (60); Halt (0) End;
     End;
     Prime (n);
     If n mod 2=0 then Begin
     If m[kol]<>n
     then If m[kol]<>n-1
          then Writeln (n*(n-1)*m[kol])
          else Writeln ((n-1)*n*Max (m[kol-1],n div 2))
     else Writeln (n*(n-1)*Max (m[kol-1],n div 2))
                            End else Begin
     If m[kol]<>n
     then If m[kol]<>n-1
          then Writeln (n*(n-1)*m[kol])
          else Writeln ((n-1)*n*Max (m[kol-1],(n-1) div 2))
     else Writeln (n*(n-1)*Max (m[kol-1],(n-1) div 2))      End;
End.

Var     n,kq:int64;
BEGIN
        readln(n);
        if (n mod 2)=1 then writeln((n-1)*(n-2)*n)
        else
        if (n mod 3)=1 then writeln((n-3)*(n-2)*(n-1))
        else writeln((n-3)*(n-1)*n);
END.

{$apptype console}
{$b-}
uses math;
var
 i,j,k,n:integer;
 mx,cur:int64;

 Function gcd(a,b:integer):integer;
 begin
   if b=0 then gcd:=a else gcd:=gcd(b,a mod b);
 end;
begin
 {reset(input,'input.txt');
 rewrite(output,'output.txt');}
 readln(n);
 if n=1 then write(1) else if n=2 then writeln(2)
                           else if n=3 then writeln(6) else
                                if n=4 then writeln(12) else if n mod 2=1 then writeln(int64(n)*int64(n-1)*int64(n-2))
                                else
                                begin
                                 mx:=-1;
                                  for i := max(1,n-100) to n do
                                    for j := max(1, n-100) to n do
                                       for k := max(1,n-100) to n do
                                         begin
                                          cur:=int64(i)*int64(j) div gcd(i,j);
                                          cur:=cur*k div gcd(cur,k);
                                          if cur>mx then mx:=cur;
                                         end;
                                         writeln(mx);
                                end;
end.

var a,b,c,q:longint;
begin
 read(a);
 b:=a;
 c:=a;
 q:=a*b*c;
 write (q);
end.

program C;
  var
    i,j:longint;
    n,ans:int64;

  function gcd(x,y:int64):int64;
    begin
      if y=0 then exit(x);
      exit(gcd(y,x mod y));
    end;

  begin
    readln(n);
    ans:=n*(n-1);
    for i:=n-2 downto 1 do
      if (gcd(n,i)=1)and(gcd(n-1,i)=1) then
        break;
    ans:=ans*i;
    writeln(ans);
  end.

program Project2;

{$APPTYPE CONSOLE}
{$R+,Q+}

uses
  SysUtils, Math;

var
  res, res2, res1, n, i1: int64;
  i: integer;

begin

  read(n);
  res := 1;

  for i := max(1, n - 2) to n do begin
    i1 := i;
    res := res * i1;
  end;

  i := 3;
  res2 := 0;
  if (n >= 4) and (n mod 2 = 0) then begin
    while (n >= 4) and (n mod 2 = 0) and (n mod i = 0) and (n - i > 0) do
      inc(i);
    if (n - i > 0) then
      res2 := res div (n - 2) * (n - i);
  end;
  if (n mod 2 = 0) and (n >= 4) then
    res1 := res div n * (n - 3);
  if (n mod 2 = 0) and (n <> 2) then
    res := res div 2;

  writeln(max(res, max(res1, res2)));

end.

var n,b:int64;
begin
read(n);
 case n of
  1: write(1);
  2:write(2);
  3:write(6);
  else if (odd(n)) then write(n*(n-1)*(n-2)) else write((n-1)*(n-2)*(n-3));
  end;
 end.

var n,k,d:int64;
 begin
  readln(n);
  if n<3 then begin
          if n=2 then writeln(2)
                 else writeln(1);
                 exit;
              end;
  if n mod 2=0 then k:=2
               else k:=1;
  if n mod 2<>0 then d:=2 else d:=1;
  if n*(n-1)*(n-2) div k >(n-2)*(n-1)*(n-3) div d then writeln(n*(n-1)*(n-2) div k)
                                                  else writeln((n-2)*(n-1)*(n-3) div d);
 end.

var n,a,b,c:int64;

function gcd(x,y:int64):int64;
var p,q:int64;
begin
    p:=x;
    q:=y;
    while p<>q do
        if p mod q=0 then
            p:=q
        else
            if q mod p=0 then
                q:=p
            else
                if p>q then
                    p:=p mod q
                else
                    q:=q mod p;
    gcd:=p;
end;

begin
    readln(n);
    if n<=2 then
        writeln(n)
    else begin
        a:=n;b:=n-1;c:=n-2;
        while (gcd(a,c)<>1)or(gcd(b,c)<>1) do dec(c);
        writeln(a*b*c);
    end;
end.

var a,b,c,q:int64;
begin
 read(a);
 b:=a-1;
 c:=a-2;
 q:=a*b*c;
 write (q);
end.

const fi = '';
      fo = '';
var n:longint;
procedure nhap;
var f:text;
begin
    assign(f,fi);
    reset(f);
    readln(f,n);
    close(f);
end;
procedure xuat;
var f:text;
    a,b:longint;
begin
    assign(f,fo);
    rewrite(f);
    if n>2 then
    begin
        if n mod 2 = 1 then write(f,n*(n-1)*(n-2))
        else if n mod 3 = 0 then write(f,(n-1)*(n-2)*(n-3))
        else write(f,n*(n-1)*(n-3));
    end
    else if n=2 then write(f,2) else write(f,1);
    close(f);
end;
begin
    nhap;
    xuat;
end.

{$Mode objfpc}

uses math;

var
    n: int64;

begin
    readln(n);
    if n= 1 then writeln(1) else
        if n= 2 then writeln(2) else
            if odd(n) then writeln(n*(n- 1)*(n- 2)) else
                writeln(n*(n- 1)*(n- 3));
              //  writeln(max((n- 1)* (n- 2)* (n- 3), n*(n- 1)*(n- 2) div 2));
end.

var
  n:longint;
  x:Qword;
begin
  readln(n);
  if n=1 then begin writeln(1);halt;end;
  if n=2 then begin writeln(2);halt;end;
  if n=3 then begin writeln(6);halt;end;
  if odd(n) then x:=n*(n-1)*(n-2)
  else begin
         if n mod 3=0 then x:=(n-1)*(n-2)*(n-3)
                      else x:=n*(n-1)*(n-3);
       end;
  writeln(x);
end.

USES MATH;
VAR N,K,L:INT64;
BEGIN
  READ(N);
  IF N<3 THEN
    BEGIN
      IF N=2 THEN WRITELN(2)
      ELSE WRITELN(1);
      HALT(0);
    END;
  if n mod 2=0 then
    begin
      if n mod 3=0 then k:=3
      else k:=1;
      writeln(n*(n-1)*(n-3) div k);
    end
  else
    begin
      writeln(n*(n-1)*(n-2));
    end;
END.

{$mode objfpc}
uses math;
const
  fi='';
  fo='';

var
  f: text;
  n: integer;
  a, b, c: integer;
  res: int64;

procedure enter;
begin
  assign(f, fi); reset(f);
  readln(f, n);
  close(f);
end;

function UCLN(a, b: integer): boolean;
var c: integer;
begin
  repeat
    if a< b then begin
      c:= a; a:= b; b:= c;
    end;
    c:= a mod b;
    a:= b;
    b:= c;
  until b= 0;
  if a= 1 then exit(true)
  else exit(false);
end;

procedure solve;
var mib, mic: integer;
begin
  res:= int64(n);
  a:= n; b:= n; c:= n;
  repeat
    if int64(a)*int64(n)*int64(n)< res then break;
    b:= n;
    repeat
      if int64(a)*int64(b)*int64(n)< res then break;
      if not UCLN(a, b) then begin
        dec(b); continue;
      end;
      c:= n;
      repeat
        if int64(a)*int64(b)*int64(c) < res then break;
        if not UCLN(a, c) or not UCLN(b, c) then begin
          dec(c); continue;
        end;
        res:= max(res, int64(a)*int64(b)*int64(c));
        dec(c);
      until c= 1;
      dec(b);
    until b= 1;
    dec(a);
  until a= 1;
end;

procedure printresult;
begin
  assign(f, fo); rewrite(f);
  writeln(f, res);
  close(f);
end;

begin
  enter;
  solve;
  printresult;
end.

var n: LongInt;
begin
  Readln(n);
  if n<3 then Writeln(n) else if odd(n) then Writeln(n*(n-1)*(n-2)) else if n mod 3=0 then Writeln((n-1)*(n-2)*(n-3)) else Writeln(n*(n-1)*(n-3));
end.

const   fi      =       '';
        fo      =       '';
var     n       :       Int64;

{}
Procedure motep;
begin
  assign(input,fi); reset(input);
  assign(output,fo); rewrite(output);
end;

{}
Procedure dongtep;
begin
  close(input); close(output);
end;

{}
Procedure solve;
begin
  read(n);
  write(n*(n-1)*(n-2));
end;

BEGIN
  motep;
  solve;
  dongtep;
END.

uses math;
var
l,r,x1,y1,nn,k,inf,x,y,dd,ans,j,v,ss,i,n,m,s:longint;
mark,q,dp,xx,yy,mas2:array[0..100003] of  longint;
a:array[0..4003,0..4000] of  longint;
ch:char;
function gcd(b,a:longint):longint;
begin
{writeln (b,a);}
if a=0 then gcd:=b
else gcd:=gcd(a,b mod a);
end;
begin
readln (n);
if n=1 then begin writeln (1);halt end else
if n=2 then begin writeln (2);halt end else
if n=3 then begin writeln (6);halt end;

i:=n-1;
while gcd(n,i)<>1 do
  dec(i);
{writeln (i);}

if i=n-1 then j:=n-2 else j:=n-1;

writeln (i*n div gcd(n,j)*j);
END.

program Project2;

{$APPTYPE CONSOLE}
{$R+,Q+}

uses
  SysUtils, Math;

var
  res, n, i1: int64;
  i: integer;

begin
//  reset(input, 'input.txt');
//  rewrite(output, 'output.txt');

  read(n);
  res := 1;

  for i := max(1, n - 2) to n do begin
    i1 := i;
    res := res * i1;
  end;

  if (n mod 2 = 0) and (n > 2) then begin
    res := res div 2;
    if (n >= 4) then
      if (n div 2 < n - 3) then
        res := res * 2 div n * (n - 3);
  end;

  writeln(res);

end.

uses math;
var
        a,b,c,d,n,i:longint;
function main:int64;
var q,w,e:int64;
begin
        readln(n);
        if n=1 then exit(1);
        if n=2 then exit(2);
        if n=3 then exit(6);
        if n=4 then exit(12);
        d:=n;
        c:=n-1;
        b:=n-2;
        a:=n-3;
        if odd(d) then exit(int64(d)*b*c);
        if (d mod 3=0) and  (a mod 3=0)  then q:=(int64(d)*c*a) div 3
        else q:=d*c*a;
        w:=int64(d)*c*b div 2;
        e:=int64(a)*b*c ;
        if w>e then e:=w;
        if q>e then e:=q;
        exit(e);

end;
begin
        writeln(main);
end.

var s,n:int64;
function ucln(a,b:int64):int64;
begin
    if b=0 then exit(a);
    exit(ucln(b,a mod b));
end;
begin
    readln(n);
    if n<3 then s:=n else
    if n=3 then s:=6 else
    if n=4 then s:=12 else
    begin
                    s:=n*(n-1)*(n-2);
                    if ucln(n,n-2)<>1 then s:=(n-1)*(n-2)*(n-3);
    end;
    write(s);
    readln;
end.

var
a,max,b1,b2,ans:int64;
i:integer;
flag:boolean;
Function GCD(m,n:int64):int64;
begin
if n mod m=0 then GCD:=m else
if m mod n=0 then GCD:=n else
begin
if m>n then GCD:=GCD(m mod n, n);
if n>m then GCD:=GCD(n mod m, m);
end;
end;
begin
read(a);
if a=1 then Writeln(1) else
if a=2 then Writeln(2) else
for i:=a-2 downto 1 do
begin
b1:=GCD(a,i);
b2:=GCD(i,a-1);
ans:=(a*(a-1)*i) div (b1*b2);
if ans>max then max:=ans;
end;
Writeln(max);
end.

uses math;
const
 pi=3.1415926535;
var
 f,ff:array[0..100,0..100] of longint;
 a,b:array[0..210000] of longint;
//  b:array[1..100] of longint;

 x,y,k,l,i,j,z,col,r,jj,m,t,ans:longint;
 st,stt:array[0..50100] of string;
 p:array[1..50000] of boolean;
 s,ss,sw:ansistring;
 ch:array['a'..'z'] of longint;
// x,y,xx,yy:extended;
 c:char;
 w:array['a'..'z'] of longint;
 xx,n,ms,tp:int64;
// v,r,s,ss,k,t,al:extended;

function nod(a,b,c:int64):int64;
 var
  x,y,k:int64;
begin
  x:=a;y:=b;
  while x*y>0 do
   if x>y then x:=x mod y else y:=y mod x;
  x:=a*b div (x+y); k:=x;
  y:=c;
  while x*y>0 do
   if x>y then x:=x mod y else y:=y mod x;
  x:=k*c div (x+y);
end;

begin
//ssign(input,'input.txt');reset(input);
//assign(output,'output.txt');rewrite(output);
 read(n);
 if n=1 then write(1) else if n=2 then write(2) else
// for i:=n downto 1 do
//  if pr(i) then break;
 begin
  if odd(n) then write(n*(n-1)*(n-2)) else
   begin
    tp:=nod(n,n-1,n-2);
    xx:=nod(n,n-1,n-3);

    write(max(tp,xx));
   end;
  end;

end.

{$mode objfpc}
var
    n : integer;
    i : integer;
    j : integer;
    res : int64;
    a : array[2..1000000] of boolean;
begin
    readln(n);
    for i := 2 to 1000000 do
        begin
            j := 2;
            while (j * i < 1000000) do
                begin
                    a[i * j] := true;
                    inc(j);
                end;
        end;
    for i := 2 to n do
        if not(a[i]) then res := i;
    if res = n then
        writeln(res * (res - 1) * (res - 2));
    if res = n - 1 then
        writeln(res * (res - 1) * n);
    if res < n - 1 then
        writeln(res * (res + 1) * (res + 2));
end.

uses math;
const
        nmax    =       100;
var
        m:longint;
        n,res:int64;
function UCLN(u,v:int64):int64;
begin
        if v=0 then exit(u) else exit(UCLN(v,u mod v));
end;
procedure nhap;
var i,j:longint;
u:int64;
begin
        read(n);
        if (n=1) then writeln(1)
        else if n=2 then writeln(2)
        else if n=3 then writeln(6)
        else
          begin
             res:=0;
             u:=n*(n-1);
             for i:=1 to n do
              res:=max(res,(i*u) div UCLN(i,u) );
             writeln(res);
           //    writeln(u*(n-3)div UCLN(u,n-3));
          end;
end;
procedure xuly;
var i,j,t,res1,res2,res3:longint;
u,v:int64;
begin
        res:=0;
        for i:=1 to n do for j:=1 to n do for t:=1 to n do
          begin
            u:=(i*j)div UCLN(i,j);
            v:=(u*t)div UCLN(u,t);
            if res<v then
              begin
                res:=v;res1:=i;res2:=j;res3:=t;
              end;
          end;
        writeln(n,' ',res,' ',res1,' ',res2,' ',res3);
end;
procedure make;
begin
        assign(output,'a.inp');rewrite(output);
        randomize;
          writeln(random(100)+1);
        close(output);
end;
begin
     //   make;
        assign(input,'');reset(input);
        assign(output,'');rewrite(output);
          nhap;
      //    xuly;
        close(input);
        close(output);
end.

var
 j,k1,k2,k3,n,m,k:int64;
 i:longint;

 function nod(x,y:int64):int64;
  begin

   while (x<>0)and(y<>0) do
    begin
     if x>y then x:=x mod y
      else y:=y mod x;

    end;
    nod:=x+y;
  end;

begin
 readln(n);
  if (N=1) then writeln(1)
   else if(n=2) then writeln(2)
  else begin
 k3:=n;
 k2:=n-1;
 for i:=k2 downto 2 do
  begin
   if (nod(k2,i)=1) and(nod(k3,i)=1) then
    begin
     k1:=i;
     break;
    end;

  end;
 if k1=0 then
   begin
    for i:=n downto 2 do
     begin
      if (k3*k2 mod i<>0) then begin
       k1:=i;
       end;
     end;
    if k1=0 then k1:=1;
    if (nod(k1,k2)<>1) then k1:=k1 div nod(k1,k2);
    if (nod(k1,k3)<>1) then k1:=k1 div nod(k1,k3);
   end;
 writeln(k1*k2*k3);
 end;
end.

VAR N:QWORD;
BEGIN
  READ(N);
  WRITELN(N*(N-1)*(N-2));
END.

Var
        kq      :int64;
        n       :longint;
begin
        read(n);
        if n=2 then write(2);
        if n=3 then write(6);
        if n>3 then
          begin
            kq:=n;
            kq:=kq*(n-1)*(n-2);
            if n mod 2=0 then write(kq div 2)
              else write(kq);
          end;
end.

const fin='';
var f:text;
     s:qword;
     n:longint;
begin
     assign(f,fin); reset(f);
     read(f,n);
     if (n=1) or (n=2) then write(n)
     else
          begin
               if n mod 2=1 then s:=n*(n-1)*(n-2)
               else
                    if n mod 3=0 then s:=(n-1)*(n-2)*(n-3)
                    else s:=n*(n-2)*(n-3);
               write(s);
          end;
end.

var i,j,k,l,m,n:longint;
    nok0,t:int64;
function nod(a,b:longint):longint;
var x,y:longint;
begin
 x:=a;
 y:=b;
 while (x>0)and(y>0) do
   if x>y then x:=x mod y else y:=y mod x;
 nod:=x+y;
end;

function nok(a,b,c:longint):int64;
var p,p1,p2,p3:longint;
begin
 p1:=nod(b,c);
 p2:=nod(a,c);
 p3:=nod(a,b);
 p:=nod(a,p1);

 nok:=b div p1*c div p2*a div p3*p;

 end;

begin
 read(n);
 if n>50 then i:=n-50 else i:=1;
while (i<=n)do
    begin
     j:=i;
     l:=i;
     while (l<=n)and(j<=n) do
       begin
           t:=nok(i,j,l);
           IF t>nok0 then nok0:=t;

           inc(l);

           if l>n then begin
             j:=j+1;
             l:=j;
                       end;
       end;

     inc(i);
    end;
  write(nok0);
end.

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, n1, i, top, j: integer;
  f, f1: boolean;
  a: array[1..100000] of integer;
  ans: int64;

begin
  //reset(input, 'input.txt'); rewrite(output, 'output.txt');
  readln(n);
  if n = 1 then
  begin
    writeln(1);
    halt;
  end;
  if n = 2 then
  begin
    writeln(2);
    halt;
  end;
  if n = 3 then
  begin
    writeln(6);
    halt;
  end;
  n1 := n;
  i := 2;
  top := 0;
  while n1 > 1 do
  begin
    while n1 mod i = 0 do
    begin
      inc(top);
      a[top] := i;
      n1 := n1 div i;
    end;
    inc(i);
  end;
  n1 := n - 1;
  i := 2;
  while n1 > 1 do
  begin
    while n1 mod i = 0 do
    begin
      inc(top);
      a[top] := i;
      n1 := n1 div i;
    end;
    inc(i);
  end;
  ans := int64(n) * int64(n - 1);
  f1 := false;
  if n mod 2 = 0 then
  begin
    for i := n - 2 downto 1 do
    begin
      f := false;
      for j := 1 to top do
      begin
        if i mod a[j] = 0 then
        begin
          f := true;
          break;
        end;
      end;
      if not f then
      begin
        ans := ans * int64(i);
        f1 := true;
        break;
      end;
    end;
    if not f1 then
      ans := ans * int64(n - 2) div 2;
  end
  else
    ans := ans * (n - 2);
  writeln(ans);
end.

var a,b,c,x,n:int64;
 begin
  read(n);
  a:=n;
  b:=n-1;
  c:=n-2;
  x:=a*b;
  while (a>0)and(b>0) do
   begin
    if a>b then a:=a mod b
           else b:=b mod a;
   end;
  a:=x div(a+b);
  x:=a*c;
  while (a>0)and(c>0) do
   if a>c then a:=a mod c
          else c:=c mod a;
  writeln(x div (c+a));
 end.

Var n:LongInt;
Begin
    // ReSet (input,'input.txt');
    // ReWrite (output,'output.txt');
     Readln (n);
     If n<3
     then Writeln (n)
     else If n mod 2=1
          then Writeln (n*(n-1)*(n-2))
          else If n mod 3=0
               then Writeln ((n-1)*(n-2)*(n-3))
               else Writeln (n*(n-1)*(n-3))
end.

var
y,x,ans:int64;
i,j,k,n,m:longint;
procedure init;
begin
	readln(n);
	if n<3 then
	begin
		writeln(0);
		halt;
	end;
end;

function gcd(a,b:int64):int64;
begin
	if b=0 then exit(a);
	exit( gcd(b,a mod b) );
end;

procedure work;
begin
	if n>50 then
	begin
		for i:=n downto n-50 do
		for j:=i-1 downto n-50 do
		for k:=j-1 downto n-50 do
		begin
			x:=i; y:=j;
			x:=x*y div gcd(x,y);
			y:=k;
			x:=x*y div gcd(x,y);
			if x>ans then ans:=x;
		end;
	end else
	begin
		for i:=n downto 1 do
		for j:=i-1 downto 1 do
		for k:=j-1 downto 1 do
		begin
			x:=i; y:=j;
			x:=x*y div gcd(x,y);
			y:=k;
			x:=x*y div gcd(x,y);
			if x>ans then ans:=x;
		end;
	end;
	writeln(ans);
end;

begin
	init;
	work;
end.

var
  lcm,max:int64;
  n,i,j,k:longint;
function gcd(x,y:int64):int64;
begin
  if y=0 then exit(x);
  exit(gcd(y,x mod y));
end;
begin
  readln(n);
  if n mod 2=1 then
  begin
   writeln(n*(n-1)*(n-2));
halt;
end;
  for i:=n-10 to n do
   if i>0 then
    for j:=n-10 to n do
      if j>0 then
      for k:=n-10 to n do
       if k>0 then
       begin
         lcm:=i*j div gcd(i,j);
         lcm:=lcm*k div gcd(lcm,k);
         if lcm>max then max:=lcm;
       end;
  writeln(max);
end.

var n,a,b,c:int64;

function gcd(x,y:int64):int64;
var p,q:int64;
begin
    p:=x;
    q:=y;
    while p<>q do
        if p mod q=0 then
            p:=q
        else
            if q mod p=0 then
                q:=p
            else
                if p>q then
                    p:=p mod q
                else
                    q:=q mod p;
    gcd:=p;
end;

begin
    readln(n);
    a:=n;
    b:=n-1;
    c:=n-2;
    while (gcd(a,c)<>1)and(gcd(b,c)<>1) do
        dec(c);
    writeln(a*b*c);
    readln;
end.

var a:array [1..1000001] of int64;
    n,j,s:int64;
    i:longint;
procedure qSort(l,r:int64);
var i,j,z,x:int64;
begin
  i:=l;
  j:=r;
  x:=a[(i+j)div 2];
  repeat
    while a[i]<x do i:=i+1;
    while a[j]>x do j:=j-1;
    if i<=j
      then
        begin
          z:=a[i];
          a[i]:=a[j];
          a[j]:=z;
          i:=i+1;
          j:=j-1;
        end;
   until (i>j);
   if i<r then qSort(i,r);
   if j>l then qSort(l,j);
end;
function nok(x,y:int64):int64;
var a,b,s:int64;
begin
  a:=x*y;
  while (x>0) and (y>0) do
    if x>y
      then x:=x mod y
        else y:=y mod x;
  s:=x+y;
  b:=a div s;
  nok:=b;
end;
begin
//  assign(input,'input.txt'); reset(input);
//   assign(output,'output.txt'); rewrite(output);
  readln(n);
  if (n=1)
    then
      begin
        writeln(1);
        exit;
      end;
  if (n=2)
    then
      begin
        writeln(2);
        exit;
      end;
  j:=1;
  for i:=3 to n do
    begin
      s:=nok(i,nok(i-1,i-2));
      a[j]:=s;
      j:=j+1;
    end;
  qsort(1,j);
  writeln(a[j]);
end.

var
i,j:longint;
f,q,nod,g,p1,x,ans,d,kol,p,n:int64;
a:array[-100..300000]of longint;
begin
readln(n);

if n<=2 then writeln(n)
else
if n=3 then writeln(6)
else begin
    if n mod 2 = 1 then begin
        for i:=n-1 downto 1 do begin
        q:=n;
        f:=i;
        while (q>0)and(f>0) do begin
            if q>f then q:=q mod f
            else
            f:=f mod q;
        end;
        nod:=f+q;
 if (i<>n-2)and(((n div nod)*(n-2)*(i div nod)*nod)>ans) then ans:=(n div nod)*(n-2)*(i div nod)*nod;

    end;
           writeln(AnS);

    end
    else begin

    for i:=n-2 downto 1 do begin
        q:=n;
        f:=i;
        while (q>0)and(f>0) do begin
            if q>f then q:=q mod f
            else
            f:=f mod q;
        end;
        nod:=f+q;
 if ((n div nod)*(n-1)*(i div nod)*nod)>ans then ans:=(n div nod)*(n-1)*(i div nod)*nod;

    end;
           writeln(AnS);
    end;

end;
end.

var i,j,k,l,m,n:longint;
    nok0,t:int64;
function nod(a,b:longint):longint;
var x,y:longint;
begin
 x:=a;
 y:=b;
 while (x>0)and(y>0) do
   if x>y then x:=x mod y else y:=y mod x;
 nod:=x+y;
end;

function nok(a,b,c:longint):int64;
var p,p1,p2,p3:longint;
begin
 p1:=nod(b,c);
 p2:=nod(a,c);
 p3:=nod(a,b);
 p:=nod(a,p1);

 nok:=a div p1*b div p2*c div p3*p;

 end;

begin
 read(n);
 if n>50 then i:=n-50 else i:=1;
while (i<=n)do
    begin
     j:=i;
     l:=i;
     while (l<=n)and(j<=n) do
       begin
           t:=nok(i,j,l);
           IF t>nok0 then nok0:=t;

           inc(l);

           if l>n then begin
             j:=j+1;
             l:=j;
                       end;
       end;

     inc(i);
    end;
  write(nok0);
end.

var  i, j, x, n, nod, lcm_r, max, q, y, z: longint;

function gcd(a, b: longint):longint;
begin
if b=0 then gcd:=a else gcd:=gcd(b,a mod b);
end;

procedure lcm(a, b, c: longint) ;
begin

  lcm_r := a * b div  gcd(a, b);
  lcm_r := c * lcm_r div   gcd(c, lcm_r);
end;

begin
readln(n);
if n=1 then begin writeln('1'); halt; end;
if n=2 then begin writeln('2'); halt; end;
for i:=n downto i do begin
    for j:=i-1 downto 1 do if gcd(i,j)=1 then break;
        for z:=j-1 downto 1 do if gcd(j,z)=1 then break;
    lcm(i, j, z);
    if (lcm_r > max) then  max := lcm_r;
    end;
    writeln(max);
end.

var n : int64;
function NOK (d1,d2,d3 : int64) : int64;
var x,y,z : int64;
begin
  x:=d1;
  y:=d2;
  z:=d3;
  while (x>0)and(y>0) do if x>y then x:=x mod y else y:=y mod x;
  x:=x+y;
  while (x>0)and(z>0) do if x>z then x:=x mod z else z:=z mod x;
  x:=x+z;
  NOK:=(d1 div x)*d2*d3;
end;
function max (x,y : int64) : int64;
begin
  if x>y then max:=x else max:=y;
end;
begin
  readln(n);
  if n=1 then writeln(1) else
  if n=2 then writeln(2) else
  if n=3 then writeln(6) else
  if n=4 then writeln(12) else
  if n=5 then writeln(60) else
  if n mod 2=1 then writeln(Nok(n,n-1,n-2)) else
  if n mod 2=0 then writeln(Max(Nok(n,n-1,n-3),Nok(n-1,n-2,n-3)));
end.

program C236;
var n: integer;
    a, k: longint;
    i, j: byte;

begin
readln(n);
a := 0;
k := 0;
if n = 1 then writeln(1)
else if n = 2 then writeln(2)
else if n = 4 then writeln(6)

else if (n mod 2 = 1) then
 begin
  writeln(n*(n-1)*(n-2));
 end
else
 begin
  if (n mod 3 <> 0) then
   writeln(n*(n-1)*(n-3))
  else begin
   for i:=1 to 5 do
    begin
     for j:=1 to 5 do
      begin
       if ((i<>j) and (i<>4) and (i<>2) and (j<>4) and (j<>2)) then
        begin
         k := (n-i) * (n-j);
         if k > a then a := k;
        end;
      end;
    end;
   writeln(n*a);
  end;
 end;
end.

var
a:int64;
i:integer;
flag:boolean;
Function GCD(m,n:int64):int64;
begin
if n mod m=0 then GCD:=m else
if m mod n=0 then GCD:=n else
begin
if m>n then GCD:=GCD(m mod n, n);
if n>m then GCD:=GCD(n mod m, m);
end;
end;
begin
read(a);
if a=1 then Writeln(1) else
if a=2 then Writeln(2) else
for i:=a-2 downto 1 do
if not flag and (GCD(a,i)=1) and (GCD(a-1,i)=1) then
begin
flag:=true;
Writeln(i*a*(a-1));
end;
end.

function nod(a,b:longint):longint;
  var c:longint;
  begin
    if b>a then begin
    c:=a; a:=b; b:=c;
    end;
    while (a mod b) <> 0 do
      begin
        c:=a mod b;
        a:=b;
        b:=c;
      end;
      nod:=b;
end;
function zxc(n,p,nok:longint):longint;
var i,no:integer;
begin
for i:=n-2 downto p do
      begin
       if nok<((n*(n-1)*i)div nod(n*(n-1),i)) then begin
       nok:=(n*(n-1)*i)div nod(n*(n-1),i); no:=nod(n*(n-1),i);
       zxc:=nok;
       end;
       if (no>1) and ((n-2) > p) then begin
       n:=n-1;
       zxc(n,p,nok);
       end;
end;
end;
var nok,no,n,m,p,p2,k,i,j:longint;

begin
   nok:=0;
  read(n);

  for i:=n-1
  downto 1 do
  begin
    m:=0;
    j:=2;
    while j<=(sqrt(i)+1) do
    begin
      if (i mod j) = 0 then m:=1;
      j:=j+1;
    end;
    if m=0 then begin p:=i; break; end;

  end;
  if p=n-1 then begin
     for i:=n-2 downto 1 do
     begin
     m:=0;
     j:=2;
     while j<=(sqrt(i)+1) do
     begin
      if (i mod j) = 0 then m:=1;
      j:=j+1;
     end;
     if m=0 then begin p2:=i; break; end;

    end;
  end;

  if n=1 then write(1)
  else if n=2 then write(2)
  else if n=3 then write(6)
  else if p = n-1 then
    begin
    write(zxc(n,p2,nok));
    end
  else if p = n - 2 then
    begin
    writeln(n*p*(n-1));
    end
  else
    begin
      write(zxc(n,p,nok));
      end;
end.

Var
        n       :int64;
        i       :longint;
        kq,x    :int64;

Function UCLN(a,b:int64):int64;
var
        r       :int64;
begin
        While b<>0 do
          begin
            r:=a mod b;
            a:=b;
            b:=r;
          end;
        exit(a);
end;

Function BCNN(a,b,c:int64):int64;
var
        x       :int64;
begin
        x:=(a*b) div UCLN(a,b);
        BCNN:=(x*c) div UCLN(x,c);
end;

begin
        read(n);
        if n=2 then write(2);
        if n=3 then write(6);
        if n=4 then write(12);
        if n>4 then
          begin
            if n mod 2=1 then write(n*(n-1)*(n-2))
              else
                begin
                  kq:=(n-1)*(n-2)*(n-3);
                  for i:=n-2 downto 1 do
                    begin
                      x:=BCNN(n,n-1,i);
                      if x>kq then kq:=x;
                    end;
                  write(kq);
                end;
          end;
end.

var
  a : array [1..1000] of longint;
  s : string;
  i,ans : longint;
begin
  readln(s);
  for i:=1 to length(S) do a[ord(s[i])]:=1;
  for i:=1 to 255 do
   if a[i]=1then inc(ans);
  if ans mod 2=0 then writeln('CHAT WITH HER!')
  else writeln('IGNORE HIM!');
end.

var
   s,n:int64;
begin
   readln(n);
   if n = 1 then s:=1
   else
   if n = 2 then s:=2
   else
   if n = 3 then s:=6
   else
   if n mod 2 = 1 then s:=n*(n-1)*(n-2)
   else
   begin
   s:=n*(n-1)*(n-3);
   end;
   writeln(s);
end.

function nod(b,a:int64):int64;
  var c:longint;
  begin
    if b>a then begin
    c:=a; a:=b; b:=c;
    end;
    while (a mod b) <> 0 do
      begin
        c:=a mod b;
        a:=b;
        b:=c;
      end;
      nod:=b;
end;
function zxc(n,p,nok:int64):int64;

var i,j,no:int64;
begin
j:=n;
i:=n-2;
while j >= p do begin
while i >=p do

      begin
       if nok<((j*(j-1)*i)div nod(j*(j-1),i)) then begin
       nok:=(j*(j-1)*i)div nod(j*(j-1),i); no:=nod(j*(j-1),i);
       zxc:=nok;
       end;
       i:=i-1;
      end;
j:=j-1;
i:=j-2;
end;
end;
var no,n,m,p,p2,k,i,j:longint;
nok:int64;

begin
   nok:=0;
  read(n);

  for i:=n-1
  downto 1 do
  begin
    m:=0;
    j:=2;
    while j<=(sqrt(i)+1) do
    begin
      if (i mod j) = 0 then m:=1;
      j:=j+1;
    end;
    if m=0 then begin p:=i; break; end;

  end;
  if p=n-1 then begin
     for i:=n-2 downto 1 do
     begin
     m:=0;
     j:=2;
     while j<=(sqrt(i)+1) do
     begin
      if (i mod j) = 0 then m:=1;
      j:=j+1;
     end;
     if m=0 then begin p2:=i; break; end;

    end;
  end;

  if n=1 then write(1)
  else if n=2 then write(2)
  else if n=3 then write(6)
  else if p = n-1 then
    begin
    write(zxc(n,p2,nok));
    end
  else if p = n - 2 then
    begin
    writeln(n*p*(n-1));
    end
  else
    begin
      write(zxc(n,p,nok));
      end;
end.