#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
int main()
{
	int N, brojac, x, y;
	x = 0; y = 0;
	long long int resenje = 1;
	string natpis;
	vector<int> br;
	br.resize(26);
	cin >> N >> natpis;
	vector<char> slova(natpis.begin(), natpis.end());
	for (char i = 'A'; i <= 'Z'; i++)
	{
		if (slova[x] != i)
		{
			x++;
			i--;
		}
		else
		{
			while (x < N && slova[x] == i)
			{
				br[y]++;
				x++;
			}
			y++;
		}
	}
	for (int i = 0; i < 26; i++)
	{
		resenje *= br[i];
	}
	cout << resenje % 1000000007;
}