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

long long dp[28];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    string s;
    cin >> s;
    for(int i = 0; i < n; i++)
    {
        if(s[i] == 'A')
        {
            dp[0]++;
            continue;
        }

        dp[s[i] - 'A'] += dp[s[i] - 'A' - 1];
        if(dp[s[i] - 'A'] >= MOD)
        {
            dp[s[i] - 'A'] %= MOD;
        }
    }

    cout << dp[25];

    return 0;
}