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

const int mod = 1e9 + 7;

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

    if (n < 26) cout << 0 << "\n";
    else {
        vector<int> alfabet[26];
        for (int i = 0; i < n; i++) {
            int duz = 0;
            int j = i;
            while(s[j] == s[i]) {
                duz++;
                j++;
            }
            alfabet[s[i] - 65].push_back(duz);
            i = j-1;
        }
        int ans = 1;
        for (int i = 0; i < 26; i++) {
            //cout << char(i + 65) << ": ";
            for (int j : alfabet[i]) {
            //    cout << j << " ";
                ans = (ans * j) % mod;
            }
          //  cout << "\n";
        }
        cout << ans << "\n";
    }
    return 0;
}