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

long long int abeceda(string s) {
	long long int k = 1, x = 1;
	for (int i = 1; i < s.length(); i++) {
		provera:
		if (s[i] == s[i - 1]) x++;
		else {
			k *= x;
			k %= 1000000007;
			x = 1;
			if (s[i] != (s[i - 1] + 1)) {
				for (int j = i; j < s.length(); j++) {
					s[i] = s[i - 1];
				}
				s.resize(s.length() - 1);
				goto provera;
			}
		}
	}
	k *= x;
	k %= 1000000007;
	return k;
}

int main() {
	int n;
	cin >> n;
	string s;
	s.reserve(n);
	cin >> s;
	cout << abeceda(s);
	return 0;
}