#include <iostream>
#include <cmath>
#include <vector>
using namespace std;

int main(int argc, char *argv[])
{
	int N, y, q;
	string s;
	long long zbir, R;
	vector <int> x;
	zbir = 1;
	y = -1;
	q = 0;
	cin>>N;
	cin>>s;
	for (int i = 1; i < N; i++)
	{
		if (s[i] == s[i-1])
		{
			if (i==1)
			{
				x.push_back(1);
				y = 0;
			}
			x[y]++;
		}
		else
		{
			if(s[i] == char(s[i-1]+1))
			{
				if(s[i] == s[i+1])
				{
					x.push_back(1);
						y++;
				}
			}
			else
			{
				s.erase(i,1);
				N--;
				q++;
			}
		}
	}
	for (unsigned int i = 0; i < x.size(); i++)
	{
		zbir = zbir * x[i];
	}
	long long m = pow(10,9) + 7;
	R = zbir % m;
	if (zbir==1)
	{
		if(N== 26 && q == 0)
			cout<<0;
		else
			cout<<1;
	}
	else
		cout<<R;
			
}