#include <bits/stdc++.h>

using namespace std;

const int N=100050;
const int MOD=1e9+7;
int n;
int f[N],p[N],a[N];

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	f[0]=0;f[1]=1;
	memset(p,0,sizeof(p));p[a[1]]=1;
	for (int i=2;i<=n;++i){
		f[i]=f[i-1];
		if (a[i]!=a[i-1])
			f[i]=(f[i]+f[p[a[i]]])%MOD;
		p[a[i]]=i;
	}
	printf("%d\n",f[n]);
}