import numpy as np



def search(A):

  B = list(set(A))

  B.sort(reverse=True)

  if len(A)-len(B) == 0: return 0 



  a1 = 0

  An = np.array(A)

  for n,(i, j) in enumerate(zip(An[0:-1], An[1:])):

    if i == j:

      a1 = i

      break

  del(A[:n+2])



  return a1



N = int(eval(input()))

A = list(map(int, input().split()))

A = [a for a in A]

A.sort(reverse=True)

a1 = search(A)

a2 = search(A)

if a1 > 0 and a2 > 0: print((a1*a2))

else: print((0))

def search(A):

  B = list(set(A))

  if len(A)-len(B) == 0: return 0 



  a1 = 0

  for n,(i, j) in enumerate(zip(A[0:-1], A[1:])):

    if i == j:

      a1 = i

      break

  del(A[:n+2])



  return a1



N = int(eval(input()))

A = list(map(int, input().split()))

A = [a for a in A]

A.sort(reverse=True)

a1 = search(A)

a2 = search(A)

if a1 > 0 and a2 > 0: print((a1*a2))

else: print((0))

import numpy as np


def search(A):
    B = list(set(A))
    B.sort(reverse=True)
    if len(A) - len(B) == 0:
        return 0
    a1 = 0
    An = np.array(A)
    for n, (i, j) in enumerate(zip(An[0:-1], An[1:])):
        if i == j:
            a1 = i
            break
    del A[: n + 2]
    return a1


N = int(eval(input()))
A = list(map(int, input().split()))
A = [a for a in A]
A.sort(reverse=True)
a1 = search(A)
a2 = search(A)
if a1 > 0 and a2 > 0:
    print((a1 * a2))
else:
    print((0))

def search(A):
    B = list(set(A))
    if len(A) - len(B) == 0:
        return 0
    a1 = 0
    for n, (i, j) in enumerate(zip(A[0:-1], A[1:])):
        if i == j:
            a1 = i
            break
    del A[: n + 2]
    return a1


N = int(eval(input()))
A = list(map(int, input().split()))
A = [a for a in A]
A.sort(reverse=True)
a1 = search(A)
a2 = search(A)
if a1 > 0 and a2 > 0:
    print((a1 * a2))
else:
    print((0))

-import numpy as np - - -    B.sort(reverse=True) -    An = np.array(A) -    for n, (i, j) in enumerate(zip(An[0:-1], An[1:])): +    for n, (i, j) in enumerate(zip(A[0:-1], A[1:])):