#include <bits/stdc++.h>
#define MOD 1000000007

using namespace std;

string s;

long long dp[30];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	
	int n;
	
	cin >> n;
	
	cin >> s;
	
	dp[0] = 1;
	
	for(int i = 0; i < n; i++)
	{
		dp[s[i] - 'A' + 1] += dp[s[i] - 'A'];
		
		dp[s[i] - 'A' + 1] = dp[s[i] - 'A' + 1] % MOD;
	}
	
	cout << dp[26];
	
	return 0;
}