#C_Make_A_Rectangle

import numpy as np



def MakeRectangle(N, A):

    A = np.array(A)

    length_list = list()

    length_buff = 0

    for length in np.sort(A)[::-1]:

        if len(length_list) == 2:

            break

        if length_buff == length and length != 0:

            length_list.append(length)

            length_buff = 0

        else:

            length_buff = length

    if len(length_list) < 2:

        return 0

    else:

        return length_list[0] * length_list[1]





if __name__ == "__main__":

    N = int(eval(input()))

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

    S = MakeRectangle(N, A)

    print(S)
#C_Make_A_Rectangle



def MakeRectangle(N, A):

    A = sorted(A, reverse=True)

    length_list = list()

    length_buff = 0

    for length in A:

        if len(length_list) == 2:

            break

        if length_buff == length and length != 0:

            length_list.append(length)

            length_buff = 0

        else:

            length_buff = length

    if len(length_list) < 2:

        return 0

    else:

        return length_list[0] * length_list[1]





if __name__ == "__main__":

    N = int(eval(input()))

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

    S = MakeRectangle(N, A)

    print(S)
# C_Make_A_Rectangle
import numpy as np


def MakeRectangle(N, A):
    A = np.array(A)
    length_list = list()
    length_buff = 0
    for length in np.sort(A)[::-1]:
        if len(length_list) == 2:
            break
        if length_buff == length and length != 0:
            length_list.append(length)
            length_buff = 0
        else:
            length_buff = length
    if len(length_list) < 2:
        return 0
    else:
        return length_list[0] * length_list[1]


if __name__ == "__main__":
    N = int(eval(input()))
    A = list(map(int, input().split()))
    S = MakeRectangle(N, A)
    print(S)

# C_Make_A_Rectangle
def MakeRectangle(N, A):
    A = sorted(A, reverse=True)
    length_list = list()
    length_buff = 0
    for length in A:
        if len(length_list) == 2:
            break
        if length_buff == length and length != 0:
            length_list.append(length)
            length_buff = 0
        else:
            length_buff = length
    if len(length_list) < 2:
        return 0
    else:
        return length_list[0] * length_list[1]


if __name__ == "__main__":
    N = int(eval(input()))
    A = list(map(int, input().split()))
    S = MakeRectangle(N, A)
    print(S)

-import numpy as np - - -    A = np.array(A) +    A = sorted(A, reverse=True) -    for length in np.sort(A)[::-1]: +    for length in A: