#include <iostream>
#include <math.h>
using namespace std;
string reverse(string s){
	string s1 = "";
	while(s!=""){
	s1=s1+s.back();
	s.pop_back();
	}
	return s1;
}
int main(int argc, char** argv) {
	string s1,s;
	int a[27];
	for(int i = 0; i<27;i++) a[i]=0;
	int kraj=1;
	int broj,ind=0;
	cin>>broj;
	cin>>s1;
	s = reverse(s1);
	if(s.size()<26) cout<<"0";
	else{
	while(s!=""){
		while(s.back()!='A'){
			s.pop_back();
		}
		for(int i = 1; i<27; i++){
			while(s.back()!= i+64){
			s.pop_back();
		}
			while(s.back() == i+64){
				a[i]++;
				s.pop_back();
			}
			
		}
		}
		for(int i = 1; i<27; i++){
			kraj = kraj * a[i];
			kraj=kraj % 1000000007;
		}
	cout<<kraj;	
	}
	return 0;
}