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

const ll MOD=(ll)1e9+7LL;
int n;
ll dp[30];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    dp[0]=1LL;
    for(int i=1; i<=n; ++i) {
        char c; cin >> c;
        dp[c-'A'+1]+=dp[c-'A'];
        if(dp[c-'A'+1]>=MOD) dp[c-'A'+1]%=MOD;
    }
    cout << dp[26];
    return 0;
}