//Luka Mitrovic
#include <iostream>
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;

int main() {

	long long mod = 1000000007;

	string alfabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	vector<int> niz(26,1);
	int n;
	string s;
	cin >> n;
	cin >> s;

	char last = 'A';
	string ostatak = "";
	int br = 0;

	for (int i = 0; i < n; i++) {
		if (s[i] == alfabet[br]) {
			br++;
			last = s[i];
		} else if (s[i] != last) {
			if (s[i] != s[i+1]) {
				s.erase(s.begin() + i);
				i--;
				n--;
			} else {
				last = s[i];
			}
		} else {
			ostatak += s[i];
		}
	}

	for (int i = 0; i < ostatak.length(); i++) {
		//cout << ostatak[i];
		niz[ostatak[i]-65]++;
	}

	long long ans = 1;
	for (int i = 0; i < 26; i++) {
		ans *= niz[i];
		ans %= mod;
	}
	
	cout << ans;
}