#include <iostream>

using namespace std;

int main()
{
    unsigned long long n, x = 1, res = 1;
    cin >> n;
    string slova;
    cin >> slova;
     if(n < 26){
        cout << 0;
        return 0;

    }else if(n == 26){
        cout << 1;
        return 0;
    }
    int i = 65;
    //bool found[26] = {true};
    for (int j = 0; j < slova.size(); j++){
        x = 1;
        if ((slova[j] == slova[j + 1]) && (slova[j] == i))
        {
                x++;
                i--;
        }
        if(slova[j] != i){
             i = slova[j];
        }
        i++;
        res *= x;

    }
    cout << res % (1000000000 + 7);
}