#include <bits/stdc++.h>

using namespace std;

const int mod = 1e9 + 7;

int add(int a, int b) {
    a += b;
    if(a >= mod)
        a -= mod;
    return a;
}

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    string s;
    cin >> n >> s;

    int dp[27];
    for(int i = 0; i <= 27; i++)
        dp[i] = 0;
    dp[0] = 1;
    for(int i = 1; i <= n; i++) {
        int new_dp[27];
        new_dp[0] = 1;
        for(int j = 1; j <= 26; j++) {
            new_dp[j] = dp[j];
            if(j == (s[i - 1] - 'A' + 1))
                new_dp[j] = add(new_dp[j], dp[j - 1]);
        }

        for(int i = 0; i <= 26; i++)
            dp[i] = new_dp[i];
    }
    cout << dp[26] << endl;
    return 0;
}