#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int mxN = 2e5, MOD = 1e9+7;
int n;
string s;
map<char, ll> pos;

int main(){

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

    cin >> n >> s;

    for (int i = 0; i < n; i++){
        if (s[i] == 'A')
            pos[s[i]]++, pos[s[i]] %= MOD;
        else
            pos[s[i]] += pos[(char)(s[i]-1)], pos[s[i]] %= MOD;
    }

    cout << pos['Z'] % MOD << '\n';

    return 0;
}