#include <bits/stdc++.h>

using namespace std;

#define pii pair<int,int>
#define ll long long
#define s second
#define f first

const int MAX_N = 10e6 + 6;
const ll MOD = 1e9 + 7;
ll n, p[28], cur[28];

string s, ab = "";

ll solve(){
  p[0] = 1;
  for(int i = 1; i <= n; ++i){
    for(int j = 1; j <= 26; ++j){
      if(s[i - 1] == ab[j - 1]){cur[j] = (p[j - 1] + p[j]) % MOD;}
      else{cur[j] = p[j];}
    }
    for(int i = 0; i < 28; ++i){
        p[i] = cur[i];
    }
    p[0] = 1;
  }
  return cur[26];
}

int main(){
  cin >> n;
  cin >> s;
  for(int i = 0; i < 26; ++i){
    ab += (char)('A' + i);
  }
  cout << solve();
  return 0;
}