#include <bits/stdc++.h>

using namespace std;

#define ll long long

ll brojNacina(string s)
{
	ll ret = 1;
	ll m = 1000000007;
	ll frek[26];
	for (ll i = 0; i < 26; i++) frek[i] = 0;
	ll n = s.size();
	for (ll i = 0; i < s.size()-1; i++)
	{
		if (s[i] > s[i+1])
		{
			frek[i+1]--;
		}
	}
	for (ll i = 0; i < s.size(); i++)
	{
		frek[s[i]-'A']++;
	}
	for (ll i = 0; i < 26; i++)
	{
		ret = (ret * frek[i]) % m;
	}
	return ret;
}

int main()
{
	ll n=0;
	cin >> n;
	string s;
	cin >> s;
	cout << brojNacina(s);
	return 0;
}