#! /usr/bin/env python3



N = int(eval(input()))

L = sorted(map(int, input().split()))[::-1]

a = 0

b = 0

while L:

    t = L.pop(0)

    if a == t:

        break

    else:

        a = t

while L:

    t = L.pop(0)

    if b == t:

        break

    else:

        b = t

    

print((a*b))
#! /usr/bin/env python3



def main():

    N = int(eval(input()))

    L = sorted(map(int, input().split()))[::-1]

    a = b = c = 0

    while c < len(L):

        t = L[c]

        c += 1

        if a == t:

            break

        else:

            a = t

    while c < len(L):

        t = L[c]

        c += 1

        if b == t:

            break

        else:

            b = t

    print((a*b))

    

if __name__ == '__main__':

    main()
#! /usr/bin/env python3
N = int(eval(input()))
L = sorted(map(int, input().split()))[::-1]
a = 0
b = 0
while L:
    t = L.pop(0)
    if a == t:
        break
    else:
        a = t
while L:
    t = L.pop(0)
    if b == t:
        break
    else:
        b = t
print((a * b))

#! /usr/bin/env python3
def main():
    N = int(eval(input()))
    L = sorted(map(int, input().split()))[::-1]
    a = b = c = 0
    while c < len(L):
        t = L[c]
        c += 1
        if a == t:
            break
        else:
            a = t
    while c < len(L):
        t = L[c]
        c += 1
        if b == t:
            break
        else:
            b = t
    print((a * b))


if __name__ == "__main__":
    main()

-N = int(eval(input())) -L = sorted(map(int, input().split()))[::-1] -a = 0 -b = 0 -while L: -    t = L.pop(0) -    if a == t: -        break -    else: -        a = t -while L: -    t = L.pop(0) -    if b == t: -        break -    else: -        b = t -print((a * b)) +def main(): +    N = int(eval(input())) +    L = sorted(map(int, input().split()))[::-1] +    a = b = c = 0 +    while c < len(L): +        t = L[c] +        c += 1 +        if a == t: +            break +        else: +            a = t +    while c < len(L): +        t = L[c] +        c += 1 +        if b == t: +            break +        else: +            b = t +    print((a * b)) + + +if __name__ == "__main__": +    main()