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

int bukve[26];

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

    char line = 'A';
    for (int 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] << " ";

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