#include <bits/stdc++.h>

using namespace std;

char a[1000002];
long int n;
long long int br[27];
using namespace std;

int main()
{
    br[0]=1;
    scanf("%ld",&n);
    getchar();
    if(n<26) {printf("0");return 0;}
    for(long int i=0;i<n;i++)
    a[i]=getchar();
    a[n]='\0';
    for(long int i=0;i<n;i++)
    {
        int pom=a[i]-'A';
        br[pom+1]=(long long int)(br[pom+1]+br[pom]);
        br[pom+1]=br[pom+1]%1000000007;

    }
    printf("%lld",br[26]);
    return 0;
}