#include <bits/stdc++.h>
using namespace std;
const int N = 5003;
const int mod = 1e9 + 7;
int n, _n;
string s;
int f[N][N];
int nxt[N][30];
long long gt[N];
int dp[N][N];
long long Pow(long long x, int k) {
  long long res = 1;
  for (; k > 0; k /= 2, x = x * x % mod)
    if (k & 1) res = res * x % mod;
  return res;
}
long long Comp(int k, int n) {
  if (k <= 0) return 1;
  long long res = gt[n] * Pow(gt[n - k], mod - 2) % mod;
  res = res * Pow(gt[k], mod - 2) % mod;
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  cin >> s;
  _n = n;
  s = s;
  gt[0] = 1;
  for (int i = 1; i < N; i++) gt[i] = 1ll * gt[i - 1] * i, gt[i] %= mod;
  string t = s;
  int j = 1;
  while (j < t.size())
    if (t[j] == t[j - 1])
      t.erase(j, 1);
    else
      j++;
  n = t.size();
  t = ' ' + t;
  for (int i = n; i >= 1; i--) {
    for (int j = 0; j < 26; j++) nxt[i][j] = nxt[i + 1][j];
    nxt[i][t[i] - 'a'] = i;
  }
  dp[n][1] = 1;
  f[n][1] = 1;
  for (int i = n - 1; i >= 1; i--) {
    int x = t[i] - 'a';
    f[i][1] = f[i + 1][1];
    if (nxt[i + 1][x] == 0) f[i][1]++;
    dp[i][1] = 1;
    for (int j = 2; j <= n; j++) {
      f[i][j] = f[i + 1][j];
      for (int k = 0; k < 26; k++) {
        if (k == x) continue;
        if (nxt[i][k]) dp[i][j] = dp[i][j] + dp[nxt[i][k]][j - 1];
        if (dp[i][j] > mod) dp[i][j] -= mod;
      }
      f[i][j] = f[i][j] + dp[i][j];
      if (f[i][j] > mod) f[i][j] -= mod;
      f[i][j] = (f[i][j] - dp[nxt[i + 1][x]][j] + mod) % mod;
    }
  }
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    int cur = _n - i;
    res = res + (1ll * f[1][i] * Comp(i - 1, cur + i - 1)) % mod;
    if (res > mod) res -= mod;
  }
  cout << res;
}
