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 maxN = 5010, modP = 1e9 + 7, oo = 23041997;
int n, f[maxN][26], res, c[maxN][maxN];
char s[maxN];
int main() {
  scanf("%d\n", &n);
  scanf("%s", s);
  for (int i = 0; i <= n; ++i) c[i][0] = 1, c[0][i] = 0;
  c[0][0] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= i; ++j)
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % modP;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= i; ++j) {
      f[j][s[i - 1] - 'a'] = 0;
      for (int t = 0; t < 26; ++t)
        if (t != s[i - 1] - 'a') {
          f[j][s[i - 1] - 'a'] += f[j - 1][t];
          f[j][s[i - 1] - 'a'] %= modP;
        }
    }
    f[1][s[i - 1] - 'a'] = 1;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 0; j < 26; ++j) {
      int tmp = (1ll * f[i][j] * c[n - 1][i - 1]) % modP;
      res = (res + tmp) % modP;
    }
  cout << res;
}
