#include <bits/stdc++.h>
using namespace std;
int n;
char s[5005];
long long fac[5005], inv[5005];
inline long long pow_(long long d, int c) {
  long long rtn = 1;
  for (; c; c >>= 1, d = d * d % 1000000007)
    if (c & 1) (rtn *= d) %= 1000000007;
  return rtn;
}
inline long long C(int a, int b) {
  return fac[a] * inv[b] % 1000000007 * inv[a - b] % 1000000007;
}
int f[5005][5005], sum[5005][5005];
int p[5005];
int pre[26];
inline void DP() {
  for (int i = 0; i <= n; ++i) sum[0][i] = 1;
  for (int j = 1; j <= n; ++j) {
    for (int i = j; i <= n; ++i) {
      (f[j][i] = sum[j - 1][i - 1] - f[j - 1][p[i]] + 1000000007) %= 1000000007;
      (((sum[j][i] = sum[j][i - 1] + f[j][i] - f[j][p[i]]) %= 1000000007) +=
       1000000007) %= 1000000007;
    }
  }
}
int main() {
  scanf("%d%s", &n, s + 1);
  for (int i = 1; i <= n; ++i) p[i] = pre[s[i] - 'a'], pre[s[i] - 'a'] = i;
  fac[0] = inv[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % 1000000007;
  inv[n] = pow_(fac[n], 1000000007 - 2);
  for (int i = n - 1; i; --i) inv[i] = inv[i + 1] * (i + 1) % 1000000007;
  DP();
  long long ans = 0;
  for (int j = 1; j <= n; ++j) {
    memset(pre, 0, sizeof pre);
    for (int i = n; i; --i) {
      if (!pre[s[i] - 'a'])
        (ans += 1ll * f[j][i] * C(n - 1, j - 1) % 1000000007) %= 1000000007,
            pre[s[i] - 'a'] = 1;
    }
  }
  printf("%I64d\n", ans);
  return 0;
}
