#include <bits/stdc++.h>

#define MOD 1000000007

using namespace std;

int main() {
	int n, x;
	int pre = 0, cur = 1;
	map<int, int> last;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		if (x == pre) {
			continue;
		}
		if (last.count(x) != 0) {
			cur = 1LL * (cur + last[x]) % MOD;
		}
		last[x] = cur;
		pre = x;
	}
	cout << cur << endl;
	return 0;
}