#include <bits/stdc++.h>
using namespace std;

#define KRJ 1000000007

long long bukve[26];

int main()
{
    long long n; cin >> n;

    char line = 'A';
    for (long long i = 0; i < n; i++)
    {
        char c; cin >> c;
        if (c < line) continue;
        bukve[c - 'A']++;
        line = c;
    }

    // for (int i = 0; i < 26; i++) cout << bukve[i] << " ";

    long long sol = 1;
    for (long long i = 0; i < 26; i++) sol = ((sol % KRJ) * (bukve[i]  % KRJ)) % KRJ;
    cout << sol;
}