import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto A = N.iota.map!(_ => readln.chomp.to!int).array;
    A = A.uniq.array;
    N = A.length.to!int;

    auto B = new long[](N+1);
    auto dp = new long[](N+1);
    dp[0] = 1;

    foreach (i; 1..N+1) {
        (dp[i] += dp[i-1]) %= MOD;
        (dp[i] += B[A[i-1]]) %= MOD;
        (B[A[i-1]] += dp[i-1]) %= MOD;
    }

    dp[N].writeln;
}
