#include <iostream>
//#include <iomanip>
//#include <cmath>
//#include <algorithm>
//#include <string>
//#include <vector>
//#include <ctime>
//#include <cstdlib>
//#include <limits>
//#include <mycpp.h>
#define MOD 1000000007

typedef unsigned long long ull;

using namespace std;

ull Fak[1000000]={0};

ull Faktorijal(ull n)
{
	if(n<=1)
		return 1;
	if(Fak[n]!=0)
		return Fak[n];
	Fak[n]=n*Faktorijal(n-1);
	return Fak[n];
}

int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	int pon[26]={0};
	int obavezno=0;
	bool slv[26]={false};
	for(int i=0;i<n;i++)
	{
		pon[s[i]-'A']++;
		if(!slv[s[i]-'A'])
		{
			slv[s[i]-'A']=true;
			continue;
		}
		if(slv[s[i]-'A'+1])
		{
			obavezno++;
		}
	}
	ull k=0,l=0;
	for(int i=0;i<26;i++)
	{
		if(pon[i]>1)
		{
			k+=pon[i];
			l++;
		}
	}
	ull a=k-obavezno,b=l;
	cout<<((Faktorijal(a))/(Faktorijal(b))/(Faktorijal(a-b)))%MOD;
}