#include <bits/stdc++.h>

using namespace std;

int main()
{
    int j = 0, n, br = 0;
    long double komb, brojkomb = 1.0 / 1000000007;
    cin >> n;
    char s[n];
    cin >> s;
    vector<char> svektor;
    vector<int> brojpon = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    brojpon[int(s[0]) - 65]++;
    for(int i = 1; i < n; i++)
    {
        if(int(s[i]) >= int(s[i - 1]))
        {
            if(int(s[i] - 65) >= j)
            {
                j = int(s[i] - 65);
                brojpon[j]++;
            }
        }
    }
    for(int i = 0; i < 26; i++)
    {
        brojkomb *= (double) brojpon[i];
    }
    long double k;
    k = trunc(brojkomb);
    komb = (brojkomb - k) * 1000000007;
    cout << setprecision(0) << fixed << komb << endl;
    return 0;
}