#include <bits/stdc++.h>

using namespace std;

const int64_t mod = 1000000007;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cerr.tie(0);

    int64_t n;
    string s;
    cin >> n >> s;

    if(n <= 26)
    {
        cout << 0 << endl;
        return 0;
    }

    int64_t i = 0;
    int64_t trenutni = (int64_t)('A');
    vector<int64_t> mnozioci;

    while(s[i] != '\0')
    {
        if((int64_t)(s[i]) == trenutni)
        {
            mnozioci.push_back(1);
            i++;
            while((s[i] != '\0') && ((int64_t)(s[i]) == trenutni)) {
                i++;
                mnozioci[mnozioci.size() - 1]++;
            }
            i--;
            trenutni++;
        }
        else
        {
            int64_t temp = (int64_t)(s[i]);
            mnozioci.push_back(1);
            while((s[i] != '\0') && ((int64_t)(s[i]) == temp)) {
                i++;
            }
            i--;
        }
        i++;
    }

    int64_t dobarf = mnozioci[0];

    for(auto i = 1; i < mnozioci.size(); i++)
        dobarf = ((dobarf % mod) * (mnozioci[i] % mod)) % mod;

    cout << dobarf << '\n';

    cout.flush();
    return 0;
}