#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

ll mod=1e9+7 ;
ll dp[200010];
int chnum[200010];
int main(){
	int n;cin>>n;
	dp[0]=1;
	for(int i=0;i<n;){
        i++;
		int C; cin>>C;
		dp[i]=dp[i-1]+(chnum[C]!=0&&chnum[C]<i-1?dp[chnum[C]]:0);
		dp[i]%=mod;
		chnum[C]=i;
	}
	cout<<dp[n]<<endl;
}
