#include <iostream>

using namespace std;

long long mnozi(long long x, long long y){
    long long r = 1;
    r = (r * (x % 1000000007)) % 1000000007;
    r = (r * (y % 1000000007)) % 1000000007;
    return r;
}

int main()
{
    long long n;
    string s;
    cin>>n>>s;

    if(n<=26)
        cout<<0;
    else if(n == 27)
    {
        int gr = 0;
        char x = 'A';
        for(int i = 0; i < 27; i++){
            if(s[i] == x)
                x++;
            else
                gr++;
        }
        if(gr > 1)
            cout<<0;
        else
            cout<<1;
    }
    else{
        char x = 'A';
        long long kon = 1;
        long long pr = 1;
        if(s[0] == x)
            x++;
        else
            pr++;
        for(int i = 1; i < n; i++){
            if(s[i] == x){
                x++;
                kon = mnozi(kon, pr);
                pr = 1;
                continue;
            }
            else if(s[i] == s[i-1]){
                pr++;
            }
            else{
                kon = mnozi(kon, pr);
                pr = 1;
            }
        }
        kon = mnozi(kon, pr);
        cout<<kon;
    }
    return 0;
}