#include <bits/stdc++.h>
using namespace std;
int f[2][5005][27], g[5005], ans, Fact[5005], Inv[5005], n, T;
char s[5005];
int C(int x, int y) {
  int ans = 1ll * Fact[x] * Inv[y] % 1000000007 * Inv[x - y] % 1000000007;
  return ans;
}
int Pow(int x, int y) {
  int res = 1;
  for (; y; y >>= 1) {
    if (y & 1) res = 1ll * res * x % 1000000007;
    x = 1ll * x * x % 1000000007;
  }
  return res;
}
int main() {
  Fact[0] = 1;
  Inv[0] = 1;
  for (int i = 1; i < 5005; i++) {
    Fact[i] = 1ll * Fact[i - 1] * i % 1000000007;
    Inv[i] = Pow(Fact[i], 1000000007 - 2);
  }
  scanf("%d", &n);
  scanf("%s", s + 1);
  memset(f, 0, sizeof(f));
  f[0][0][26] = 1;
  int cur = 0;
  for (int i = 1; i <= n; i++) {
    cur = cur ^ 1;
    for (int j = i - 1; j; j--) {
      for (int k = 0; k < 26; k++)
        if (s[i] - 'a' != k)
          f[cur][j][k] = f[cur ^ 1][j][k];
        else
          f[cur][j][k] = 0;
      for (int k = 0; k < 26; k++)
        if (s[i] - 'a' != k)
          (f[cur][j + 1][s[i] - 'a'] += f[cur ^ 1][j][k]) %= 1000000007;
    }
    f[cur][1][s[i] - 'a'] = 1;
  }
  for (int i = 1; i <= n; i++) {
    g[i] = 0;
    for (int j = 0; j < 26; j++) (g[i] += f[cur][i][j]) %= 1000000007;
  }
  for (int i = 1; i <= n; i++)
    ans = (ans + 1ll * g[i] * C(n - 1, i - 1) % 1000000007) % 1000000007;
  printf("%d\n", ans);
}
