#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[n + 1][27];
    dp[0][0] = 1;
    for(int i = 1; i <= 26; i++)
        dp[0][i] = 0;
    for(int i = 1; i <= n; i++)
        dp[i][0] = 1;
    
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= 26; j++) {
            dp[i][j] = dp[i - 1][j];
            if(j == (s[i - 1] - 'A' + 1))
                dp[i][j] = add(dp[i][j], dp[i - 1][j - 1]);
        }
    }
    cout << dp[n][26] << endl;
    return 0;
}