output_description: Print the number of possible final sequences of colors of the stones, modulo
  10^9+7.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      C_1
      :
      C_N
attempt: N = int(input())
  C = [int(input()) for i in range(N)]
  a = [0] * N
  p = {}
  m = 10**9 + 7
  for i, c in enumerate(C):
      a[i] = a[i - 1]
      if c in p and p[c] < i - 1:
          a[i] = (a[i] + a[p[c]] + 1) % m
      p[c] = i
  print(a[-1] + 1)
  
problem_description: Statement
  
  There are N stones arranged in a row. The i-th stone from the left is painted
  in the color C_i.
  
  Snuke will perform the following operation zero or more times:
  
    * Choose two stones painted in the same color. Repaint all the stones between them, with the color of the chosen stones.
  
  Find the number of possible final sequences of colors of the stones, modulo
  10^9+7.
samples: [{"input": "5\n    1\n    2\n    1\n    2\n    2", "output": "3\n    \n\nWe can make three sequences of colors of stones, as follows:\n\n  * (1,2,1,2,2), by doing nothing.\n  * (1,1,1,2,2), by choosing the first and third stones to perform the operation.\n  * (1,2,2,2,2), by choosing the second and fourth stones to perform the operation.\n\n* * *"}, {"input": "6\n    4\n    2\n    5\n    4\n    2\n    4", "output": "5\n    \n\n* * *"}, {"input": "7\n    1\n    3\n    1\n    2\n    3\n    3\n    2", "output": "5"}]