#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ll long long
#define pb push_back
#define endl "\n"
#define amfetamin ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
const int N = 1e6 + 5;
const ll M = 1e9 + 7;
ll dp[N][27];
int main()
{
amfetamin;
int n;
string s;
cin >> n;
cin >> s;
string al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int i = 0; i <= n; i++)
    dp[i][0] = 1;
for (int i = 1; i <= n; i++)
    for (int j = 1; j <= 26; j++)
    {
        if (s[i - 1] == al[j - 1])
            dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
        else
            dp[i][j] = dp[i - 1][j];
        dp[i][j] %= M;
    }
cout << dp[n][26];




}