#include <bits/stdc++.h>

using namespace std;

int modulo = 10e8 + 7;

string s;

unordered_map<char, long long int> mapa;

int main()
{
    int n;

    cin >> n;

    cin >> s;
 
    long long int rez = 1;

    mapa[s[0]] = mapa[s[0]] + 1;

    for(int i = 1; i < n; i++)
    {
        if(s[i] >= s[i - 1])
        {
            mapa[s[i]] = mapa[s[i]] + 1;
        }
    }

    string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    for(int i = 0; i < alphabet.size(); i++)
    {
        rez *= mapa[alphabet[i]];
        rez = rez % modulo;
    }

    cout << rez;

    return 0;
}