import sys

n=int(eval(input()))

c=[int(i) for i in sys.stdin]

x=[0]*(200001)

c.append(0)

x[c[0]]+= 1

num=1

p=10**9 +7

for i in range(1,n):

  if c[i]-c[i-1]:

    x[c[i]]+= num

    x[c[i]]= x[c[i]]%p

  if c[i]-c[i+1]:

    num=x[c[i]]%p

  else:

    num=0

print(num)
import sys

n=int(eval(input()))

c=[int(i) for i in sys.stdin]

#連続した数を除去したlist

d=[]

#前の数を保存する変数

stack=0

for i in c:

  if i!=stack:

    d.append(i)

  stack=i

#0で初期化

x=[0]*200001

sum=1

p=10**9+7

for i in range(0,len(d)):

  x[d[i]]= (x[d[i]]+sum)%p

  sum=x[d[i]]%p

print(sum)
import sys

n = int(eval(input()))
c = [int(i) for i in sys.stdin]
x = [0] * (200001)
c.append(0)
x[c[0]] += 1
num = 1
p = 10**9 + 7
for i in range(1, n):
    if c[i] - c[i - 1]:
        x[c[i]] += num
        x[c[i]] = x[c[i]] % p
    if c[i] - c[i + 1]:
        num = x[c[i]] % p
    else:
        num = 0
print(num)

import sys

n = int(eval(input()))
c = [int(i) for i in sys.stdin]
# 連続した数を除去したlist
d = []
# 前の数を保存する変数
stack = 0
for i in c:
    if i != stack:
        d.append(i)
    stack = i
# 0で初期化
x = [0] * 200001
sum = 1
p = 10**9 + 7
for i in range(0, len(d)):
    x[d[i]] = (x[d[i]] + sum) % p
    sum = x[d[i]] % p
print(sum)

-x = [0] * (200001) -c.append(0) -x[c[0]] += 1 -num = 1 +# 連続した数を除去したlist +d = [] +# 前の数を保存する変数 +stack = 0 +for i in c: +    if i != stack: +        d.append(i) +    stack = i +# 0で初期化 +x = [0] * 200001 +sum = 1 -for i in range(1, n): -    if c[i] - c[i - 1]: -        x[c[i]] += num -        x[c[i]] = x[c[i]] % p -    if c[i] - c[i + 1]: -        num = x[c[i]] % p -    else: -        num = 0 -print(num) +for i in range(0, len(d)): +    x[d[i]] = (x[d[i]] + sum) % p +    sum = x[d[i]] % p +print(sum)