15
txxtxttxxttxtxx
 3
myw
 127
xixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxixhxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxix
 1
a
 10
isssisssss
 2
ff
 1
z

27824
 10
 944124121
 1
 176
 1
 1

#include <bits/stdc++.h>
using namespace std;
const int MAX = (const int)(5e3 + 11);
const int MOD = (const int)(1e9 + 7);
int D[MAX][MAX];
int C[MAX][MAX];
int P[30];
int N;
char A[MAX];
static inline void add(int &a, int b) {
  int64_t x = 0LL + a + b;
  if (x >= MOD) x -= MOD;
  a = (int)x;
}
static void solve(std::int32_t test) {
  memset(D, 0, sizeof(D));
  memset(C, 0, sizeof(C));
  memset(P, 0xFF, sizeof(P));
  C[0][0] = 1;
  for (int n = 1; n < MAX; ++n)
    for (int k = 1; k <= n; ++k) {
      add(C[n][k], C[n - 1][k - 1]);
      add(C[n][k], C[n - 1][k]);
    }
  cin >> N;
  cin >> A;
  for (int i = 0; i < N; ++i) {
    if (A[i] == A[i - 1]) continue;
    int w = A[i] - 'a';
    D[i][1] = 1;
    for (int c = 0; c < 26; ++c) {
      if (P[c] != -1 && c != w) {
        for (int j = 1; j < i + 1; ++j) {
          add(D[i][j + 1], D[P[c]][j]);
        }
      }
    }
    P[w] = i;
  }
  int64_t res = 0;
  for (int c = 0; c < 26; ++c) {
    if (P[c] != -1) {
      for (int k = 1; k <= N; ++k) {
        res += 1LL * C[N][k] * D[P[c]][k];
        res %= MOD;
      }
    }
  }
  cout << res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout << setprecision(12) << fixed;
  solve(0);
  return 0;
}
