#include <limits>
#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
vector <char> s;
vector <char> s1(26,'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
long long int broj(vector <char> s,vector <char> s1)
{
    long long int m = s.size(),n = s1.size();
	long long int matrica[m + 1][n + 1];
	int i,j;
    for (i=0;i<=n;++i)
        matrica[0][i] = 0;
    for (i=0;i<=m;++i)
        matrica[i][0] = 1;
    for (i=1;i<=m;i++)
    {
        for (j=1;j<=n;j++)
        {
            if (s[i-1]==s1[j-1])
                matrica[i][j]=matrica[i-1][j-1]+matrica[i-1][j];
            else
                matrica[i][j]=matrica[i-1][j];
        }
    }
    return matrica[m][n];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<26;i++)
    {
        s1[i]=i+65;
    }
    for(int i=0;i<n;i++)
    {
        char a;
        cin>>a;
        s.push_back(a);
    }
    if (n==26)
        cout<<0;
    else
        cout<<broj(s,s1)%(1000000000+7) ;
}