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

int main(){

	int n;
	cin>>n;
	int c[26];
	for(int i =0;i<26;i++){c[i] = 0;}
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	getchar();
	for(int i =0;i<n;i++){
		char t = getchar();
		int k = t-'A';
		//cout<<k<<endl;
		if(k==0){c[0]++; if(c[0]==MOD){c[0]=0;}}
		else if(c[k-1]+c[k]>=MOD){c[k]=(c[k-1]+c[k])%MOD;} 
		else{c[k]=c[k]+c[k-1];}
	}
	cout<<c[25];
	return 0;
}