#include <bits/stdc++.h>
using namespace std;
#define N 200100
const int mod=1e9+7;

int n,c[N],L[N],now[N],dp[N];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&c[i]);
	n=unique(c+1,c+n+1)-c-1;
	for (int i=1;i<=n;i++) L[i]=now[c[i]],now[c[i]]=i;
	dp[0]=1;
	for (int i=1;i<=n;i++) {
		dp[i]=dp[i-1];
		if (L[i]) dp[i]=(dp[i]+dp[L[i]])%mod;
	}
	printf("%d\n",dp[n]);
	return 0;
}
