from collections import defaultdict



N=int(eval(input()))

C=[int(eval(input())) for _ in range(N)]



d = defaultdict(int)



ans=1

for i,c in enumerate(C):

    if i>=1 and C[i-1]==C[i]:

        continue

    else:

        ans+=d[c]

        d[c]=ans

        

        ans%=10**9+7

        d[c]%=10**9+7

print(ans)
MOD = 10**9 + 7

N = int(eval(input()))

C = [int(eval(input())) for _ in range(N)]



L = [-1]*(2*10**5+10)

dp = [-1]*(2*10**5+10)

dp[0] = 1



for i in range(N):

    if L[C[i]] == -1:

        dp[i+1] = dp[i]

    elif C[i] == C[i-1]:

        dp[i+1] = dp[i]

    else:

        dp[i+1] = dp[i]+dp[L[C[i]]]

    dp[i+1] %= MOD

    L[C[i]] = i+1

print((dp[N]))

from collections import defaultdict

N = int(eval(input()))
C = [int(eval(input())) for _ in range(N)]
d = defaultdict(int)
ans = 1
for i, c in enumerate(C):
    if i >= 1 and C[i - 1] == C[i]:
        continue
    else:
        ans += d[c]
        d[c] = ans
        ans %= 10**9 + 7
        d[c] %= 10**9 + 7
print(ans)

MOD = 10**9 + 7
N = int(eval(input()))
C = [int(eval(input())) for _ in range(N)]
L = [-1] * (2 * 10**5 + 10)
dp = [-1] * (2 * 10**5 + 10)
dp[0] = 1
for i in range(N):
    if L[C[i]] == -1:
        dp[i + 1] = dp[i]
    elif C[i] == C[i - 1]:
        dp[i + 1] = dp[i]
    else:
        dp[i + 1] = dp[i] + dp[L[C[i]]]
    dp[i + 1] %= MOD
    L[C[i]] = i + 1
print((dp[N]))

-from collections import defaultdict - +MOD = 10**9 + 7 -d = defaultdict(int) -ans = 1 -for i, c in enumerate(C): -    if i >= 1 and C[i - 1] == C[i]: -        continue +L = [-1] * (2 * 10**5 + 10) +dp = [-1] * (2 * 10**5 + 10) +dp[0] = 1 +for i in range(N): +    if L[C[i]] == -1: +        dp[i + 1] = dp[i] +    elif C[i] == C[i - 1]: +        dp[i + 1] = dp[i] -        ans += d[c] -        d[c] = ans -        ans %= 10**9 + 7 -        d[c] %= 10**9 + 7 -print(ans) +        dp[i + 1] = dp[i] + dp[L[C[i]]] +    dp[i + 1] %= MOD +    L[C[i]] = i + 1 +print((dp[N]))