#include <bits/stdc++.h>

#define N 1'000'000

auto main() -> int {
	std::ios_base::sync_with_stdio(false);

	size_t n;
	char s[N + 1];
	std::cin >> n >> s;

	size_t letters_encountered[26];
	std::memset(letters_encountered, 0, 26 * sizeof (size_t));

	const char* curr = s;
	char last = *curr - 1;

	while (*curr) {
		if (*curr == last) {
			++letters_encountered[*curr - 'A'];
			++curr;
		} else if (*curr == last + 1) {
			last = *curr;
			++letters_encountered[*curr - 'A'];
			++curr;
		} else {
			++curr;
		}

	}

	size_t result = 1;
	for (size_t i = 0; i < 26; ++i)
		result *= letters_encountered[i];

	std::cout << result % 1'000'000'007 << '\n';
}