#include <bits/stdc++.h>
using namespace std;
int n, i, j, k, hh, now, ans, la[5010], f[5010][5010], c[5010][5010], sum[5010],
    p = 1e9 + 7;
char s[5010];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  f[0][0] = 1;
  for (i = 0; i <= n + 1; i++) c[i][0] = 1;
  for (i = 1; i <= n + 1; i++)
    for (j = 1; j <= i; j++) c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % p;
  for (k = 1; k <= n; k++) {
    memset(sum, 0, sizeof(sum));
    if (k == 1) sum[0] = 1;
    memset(la, 0, sizeof(la));
    for (i = 1; i <= n; i++) {
      if (!la[s[i] - 'a'])
        hh = 0;
      else
        hh = sum[la[s[i] - 'a']];
      f[k][i] = (sum[i - 1] - hh + p) % p;
      sum[i] = (sum[i - 1] + f[k - 1][i]) % p;
      la[s[i] - 'a'] = i;
    }
  }
  for (j = 1; j <= n; j++)
    for (i = 1; i <= n; i++) {
      now = f[i][j];
      ans = (ans + 1ll * f[i][j] * c[n - i - 1 + i][i - 1] % p) % p;
    }
  printf("%d", ans);
}
