#include <iostream>
#include <vector>

using namespace std;

int main()
{
    vector<int> a(26);
    string s;
    int n;
    cin >> n;
    cin >> s;
    if (n < 26)cout << 0 << endl;
    else {
        char x;
        int i = 0;
        while (i < n) {
            if (s[i] == 'A')break;
            i++;
        }
        x = 'A';
        i++;
        int j = 0;
        a[j]++;
        int w = 1;
        while (i < n) {
            if (x == s[i])a[j]++;
            else if (x == s[i] - 1) {
                x = s[i];
                j++;
                a[j]++;
            }
            i++;
        }
        i = 0;
        while (i < 26) {
            w = (w * (a[i] % 1000000007)) % 1000000007;
            i++;
        }
        cout << w << endl;
    }
}