#include <bits/stdc++.h>

using namespace std;

#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define vt vector
#define all(x) (x).begin(), (x).end()
#define sp ' '
#define ar array
#define fi first
#define se second
#define ends "\n"
#define fu function

const int MOD=1e9+7;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

void DBG() {
    cerr << "]" << endl;
}
template<class H, class... T> void DBG(H h, T... t) {
    cerr << to_string(h);
    if(sizeof...(t))
        cerr << ", ";
    DBG(t...);
}
#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", DBG(__VA_ARGS__)


int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
 	int N; cin >> N;
 	string S; cin >> S;
 	string T="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 	vector<vector<int>> dp(27, vector<int>(N+5));

    for(int i=0; i<=N; ++i)dp[0][i]=1;

 	for(int i=1; i<=26; ++i){
 		for(int j=1; j<=N; ++j){
 			if(S[j-1]==T[i-1]){
 				dp[i][j]=((dp[i-1][j-1]%MOD)+(dp[i][j-1]%MOD))%MOD;
 			}else{
 				dp[i][j]=dp[i][j-1];
 			}
 		}
 	}
 	cout << dp[26][N] << ends;
}