#include <iostream>
#include <string>

using namespace std;

const int siz = 100;

int main()
{
	int n;
	string s;
	string aux = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	cin >> n >> s;

	int mem[siz][27];
	
	for (int i = 0; i < 27; ++i)
		mem[0][i] = 0;

	for (int i = 0; i <= n; ++i)
		mem[i][0] = 1;

	

	for (int i = 1; i <= n; ++i)
		for (int j = 1; j < 27; ++j)
		{
			int res;
			if (s[i - 1] == aux[j-1]) res = mem[i - 1][j- 1] + mem[i - 1][j];
			else res = mem[i - 1][j];
			if(res >- 1000000007) res%=1000000007;
			mem[i][j] = res;
		}

	cout << mem[n][26] << endl;
}