Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
a=list(map(int,input().split()))
b=collections.Counter(a)
c=list(b.items())
d=[]
e=[]
for i in range(len(c)):
  if c[i][1]>3:
    d.append(int(c[i][0]))
  elif c[i][1]>1:
    e.append(int(c[i][0]))
d.sort(reverse=True)
e.sort(reverse=True)
if len(d)<1 and len(e)<2:
  print(0)
else:
  print(max((d[0])**2,e[0]*e[1]))
    


Fixed submission:
import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])

Buggy python submission (verdict: Runtime Error):
import collections
n=int(input())
a=list(map(int,input().split()))
b=collections.Counter(a)
c=list(b.items())
d=[]
e=[]
for i in range(len(c)):
  if c[i][1]>3:
    d.append(int(c[i][0]))
  elif c[i][1]>1:
    e.append(int(c[i][0]))
d.sort(reverse=True)
e.sort(reverse=True)
if len(d)<1 and len(e)<2:
  print(0)
else:
  print(max(d[0]**2,e[0]*e[1]))
    


Fixed submission:
import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
  if b[i]>1:
    c=Counter(a).keys()
    lst.append(int(c[i]))
Lst=list(set(lst.sort(reverse=True)))
if len(Lst)<2:
  print(0)
else:
  print(Lst[0]*Lst[1])
    


Fixed submission:
import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
  if b[i]>1:
    c=Counter(a).keys()
    lst.append(int(c[i]))
Lst=list(set(lst.sort(reverse=True)))
if len(Lst)<2:
  print(0)
else:
  print(Lst[0]*Lst[1])
    


Fixed submission:
import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
  if b[i]>1:
    lst.append(int(Counter(a).keys()[i]))
Lst=set(lst)
lst.sort(reverse=True)
Lst_2=set(lst)
if len(Lst)<2:
  print(0)
else:
  print(Lst_2[0]*Lst_2[1])
    


Fixed submission:
import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])

Buggy python submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
  if b[i]>1:
    lst.append(int(Counter(a).keys()[i]))
lst.sort(reverse=True)
if len(lst)<2:
  print(0)
else:
  print(lst[0]*lst[1])
    

Fixed submission:
import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])