output_description: Print the maximum possible area of the rectangle. If no rectangle can be
  formed, print 0.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 ... A_N
attempt: import string
  
  char = string.ascii_lowercase
  numbering = {}
  for i in range(26):
      numbering[char[i]] = i
  A = input()
  n = len(A)
  next = [[n + 1] * 26 for i in range(n + 1)]
  next[n][numbering[A[n - 1]]] = n
  for i in range(n - 1, -1, -1):
      for j in range(26):
          next[i][j] = next[i + 1][j]
      next[i][numbering[A[i]]] = i
  
  dp = ["z" * n for i in range(n + 1)]
  dp[n] = "a"
  for i in range(n - 1, -1, -1):
      m = 0
      length = n
      for c in range(26):
          if next[i][c] > n and char[c] < dp[i]:
              dp[i] = char[c]
              break
          else:
              if length > len(dp[next[i][c] + 1]) + 1:
                  length = len(dp[next[i][c] + 1]) + 1
                  m = c
      try:
          if (
              dp[i] > char[m] + dp[next[i][m] + 1]
              and len(dp[i]) > len(dp[next[i][m] + 1]) + 1
          ):
              dp[i] = char[m] + dp[next[i][m] + 1]
      except IndexError:
          pass
  print(dp[0])
  
problem_description: Statement
  
  We have N sticks with negligible thickness. The length of the i-th stick is
  A_i.
  
  Snuke wants to select four different sticks from these sticks and form a
  rectangle (including a square), using the sticks as its sides. Find the
  maximum possible area of the rectangle.
samples: [{"input": "6\n    3 1 2 4 2 1", "output": "2\n    \n\n1 \\times 2 rectangle can be formed.\n\n* * *"}, {"input": "4\n    1 2 3 4", "output": "0\n    \n\nNo rectangle can be formed.\n\n* * *"}, {"input": "10\n    3 3 3 3 4 4 4 5 5 5", "output": "20"}]