#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long int n;
    cin >> n;
    char title[n];

    int letters[26] = {0};
    char last_char = ' ';
    for(int i = 0; i < n; i++)
    {
        cin >> title[i];
        if (title[i] >= last_char)
        {
            last_char = title[i];
            letters[last_char % 26]++;
        }
    }

    long long total = 1;
    for(int i = 0; i < 26; i++)
    {
        total *= letters[i];
    }

    cout << total % 1000000007;

    return 0;
}