#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long dp[5011][5011];
int nxt[6000][27];
long long cnt[5011];
long long inv[100000 + 1];
long long kai[100000 + 1];
long long invkai[100000 + 1];
void invinit() {
  inv[1] = 1;
  for (int i = 2; i <= 100000; i++) {
    inv[i] = mod - (mod / i) * inv[mod % i] % mod;
  }
  kai[0] = invkai[0] = 1;
  for (int i = 1; i <= 100000; i++) {
    kai[i] = kai[i - 1] * i % mod;
    invkai[i] = invkai[i - 1] * inv[i] % mod;
  }
}
long long com(long long a, long long b) {
  if (b < 0 || a < b) return 0;
  return (invkai[b] * invkai[a - b]) % mod * kai[a] % mod;
}
int main() {
  int num;
  scanf("%d", &num);
  string str;
  cin >> str;
  str.push_back('z' + 1);
  for (int i = 0; i < 27; i++) {
    int now = 5005;
    for (int j = num; j >= 0; j--) {
      nxt[j][i] = now;
      if (str[j] == i + 'a') now = j;
    }
  }
  for (int i = 0; i <= num; i++) dp[i][0] = 1;
  for (int i = num - 1; i >= 0; i--) {
    for (int j = 0; j <= num; j++) {
      dp[i][j + 1] = (dp[i + 1][j + 1] + dp[i + 1][j] + mod -
                      dp[nxt[i][str[i] - 'a']][j]) %
                     mod;
      cnt[j + 1] += dp[i][j + 1] - dp[i + 1][j + 1] + mod;
    }
  }
  for (int i = 1; i <= num; i++) cnt[i] %= mod;
  invinit();
  long long ans = 0;
  for (int i = 1; i <= num; i++) {
    ans += cnt[i] * com(num - 1, i - 1);
    ans %= mod;
  }
  printf("%I64d\n", ans);
}
