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: N = int(input())
  A = input()
  B = input()
  
  
  def f(horizontal_flag):
      if horizontal_flag[0]:
          if horizontal_flag[1]:
              return 3
          else:
              return 1
      else:
          return 2
  
  
  if N == 1:
      print(3)
  else:
      if A[0] == A[1]:
          counter = 6
          initial_num = 2
          horizontal_flag = [0, 1]
      else:
          counter = 3
          initial_num = 1
          horizontal_flag = [0, 1]
  
      for i in range(initial_num, N):
          if i == N - 1:
              if horizontal_flag[1] == 2:
                  horizontal_flag[1] = 1
                  counter *= f(horizontal_flag)
              else:
                  horizontal_flag[1] = 0
                  counter *= f(horizontal_flag)
          elif A[i] == A[i + 1]:
              horizontal_flag[1] = 2
          else:
              if horizontal_flag[1] == 2:
                  horizontal_flag[1] = 1
                  counter *= f(horizontal_flag)
              else:
                  horizontal_flag[1] = 0
                  counter *= f(horizontal_flag)
              horizontal_flag[0] = horizontal_flag[1]
      print(counter % 1000000007)
  
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"}]