#include <bits/stdc++.h>
#define maxn 1000010
using namespace std;

const int mod = 1e9 + 7;
int n, ans, dp[maxn][30];
string a;

int main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cin >> n >> a;
	dp[0][0] = 1;
	for(int i = 1; i <= n; ++i){
		dp[i][0] = 1 ;
		for(int j = 1; j < 27; ++j){
			dp[i][j] = dp[i-1][j];
			if((a[i-1]-'A'+1)==j){
				dp[i][j] += dp[i-1][j-1];
			}
			if(dp[i][j] >= mod){
				dp[i][j] -= mod;
			}
		}
	}
	cout << dp[n][26] << '\n';
}