#include <bits/stdc++.h>
using namespace std;
long long sum[5005], summ[5005];
long long dp[5005][26], dpp[5005][26];
long long fac[5005];
long long inv[5005];
const int mod = 1e9 + 7;
long long qpow(long long a, long long b) {
  long long ans = 1;
  long long k = a;
  while (b) {
    if (b & 1) ans = ans * k % mod;
    k = k * k % mod;
    b >>= 1;
  }
  return (ans + mod) % mod;
}
void init(int xx) {
  long long it;
  fac[0] = 1;
  inv[0] = 1;
  fac[1] = 1;
  inv[1] = 1;
  for (int i = 2; i <= xx; i++)
    fac[i] = fac[i - 1] * i % mod,
    inv[i] = mod - (mod / i) * inv[mod % i] % mod;
  for (int i = 1; i <= xx; i++) inv[i] = inv[i - 1] * inv[i] % mod;
}
long long C(long long n, long long m) {
  if (n < m || m < 0) return 0;
  return (fac[n] * inv[m] % mod * inv[n - m] % mod + mod) % mod;
}
vector<int> V;
char s[5005];
int main() {
  init(5004);
  int n;
  cin >> n;
  scanf("%s", s + 1);
  V.push_back(-1);
  for (int i = 1; i <= n; i++) {
    V.push_back(s[i] - 'a');
  }
  V.resize(unique(V.begin(), V.end()) - V.begin());
  int len = V.size() - 1;
  for (int i = 1; i <= len; i++) {
    memcpy(dpp, dp, sizeof(dp));
    memcpy(summ, sum, sizeof(sum));
    for (int j = i - 1; j >= 1; j--) {
      long long tmp = (summ[j] - dp[j][V[i]] - dp[j + 1][V[i]]) % mod;
      dp[j + 1][V[i]] += tmp;
      dp[j + 1][V[i]] %= mod;
      sum[j + 1] += tmp;
      sum[j + 1] %= mod;
    }
    if (!dp[1][V[i]]) dp[1][V[i]] = 1, sum[1]++;
  }
  long long ans = 0;
  for (int i = 1; i <= len; i++) {
    for (int j = 0; j < 26; j++) {
      ans += (long long)C(n - 1, i - 1) * dp[i][j] % mod;
      ans %= mod;
    }
  }
  cout << ans << endl;
}
