#include <bits/stdc++.h>
using namespace std;

const int N = 200005, MOD = 1E9 + 7;

int n, u, cur = 1, lst = 0, dp[N];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> u;
        if (u != lst) {
            lst = u;
            cur = ((dp[u] += cur) %= MOD);
        }
    }
    cout << cur;
}
