#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=2e5+5;
const int mod=1e9+7;
int cnt[N],a[N];
int main(){
    int n;scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",a+i);
    n=unique(a+1,a+n+1)-a-1;
    int ans=1;
    for(int i=1;i<=n;i++){
        int t=ans;
        (ans+=cnt[a[i]])%=mod;
        (cnt[a[i]]+=t)%=mod;
    }
    printf("%d\n",ans);
}
