#include <iostream>
using namespace std;

unsigned long long int number_of_possibilities(long int N, char a[1000000])
{
	long int b[26];
	int m=64;
	unsigned long long int r;
	for(int j=0;j<26;j++)
	{
		b[j]=0;
	}
	for(long int i=0;i<N;i++)
	{
		if((m==a[i]-1||m==a[i])&&a[i]>=65)
		{
		b[a[i]-65]++;
		m=a[i];
		}
	}
	if (N<=26)
		r=0;
	else 
		r=1;
	for(int k=0;k<26;k++)
	{
		r=r*b[k];
	}
	r=r%1000000007;
	return r;
}
int main() {
	long int N;
	char a[1000000];
	cin>>N;
	cin>>a;
	cout<<number_of_possibilities(N,a);
	return 0;
}