#include<cstdio>
#include<algorithm>
#include<cstring>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
int n,a[200005];
ll f[200005],g[200005];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==a[i-1])i--,n--;
	}
	f[0]=1;
	for(int i=1;i<=n;i++)
	{
		f[i]=f[i-1]+g[a[i]];
		if(f[i]>MOD)f[i]-=MOD;
		g[a[i]]=f[i];
	}
	printf("%lld\n",f[n]);
	return 0;
}