#include <bits/stdc++.h>
inline int getint() {
  register char ch;
  while (!isdigit(ch = getchar()))
    ;
  register int x = ch ^ '0';
  while (isdigit(ch = getchar())) x = (((x << 2) + x) << 1) + (ch ^ '0');
  return x;
}
const int N = 5001, SIGMA = 27, mod = 1e9 + 7;
char s[N];
int f[N][SIGMA], sum[N], fact[N], inb[N];
inline int idx(const char &ch) { return ch - 'a' + 1; }
void exgcd(const int &a, const int &b, int &x, int &y) {
  if (!b) {
    x = 1;
    y = 0;
    return;
  }
  exgcd(b, a % b, y, x);
  y -= a / b * x;
}
inline int inv(const int &x) {
  int ret, tmp;
  exgcd(x, mod, ret, tmp);
  return (ret % mod + mod) % mod;
}
inline int C(const int &n, const int &m) {
  return (long long)fact[n] * inb[n - m] % mod * inb[m] % mod;
}
int main() {
  const int n = getint();
  scanf("%s", s);
  fact[0] = inb[0] = 1;
  for (register int i = 1; i < n; i++) {
    fact[i] = (long long)fact[i - 1] * i % mod;
    inb[i] = inv(fact[i]);
  }
  sum[0] = 1;
  for (register int i = 0; i < n; i++) {
    const int ch = s[i] - 'a' + 1;
    for (register int j = 1; j <= n; j++) {
      sum[j] = (sum[j] - f[j][ch] + mod) % mod;
      f[j][ch] = (sum[j - 1] - f[j - 1][ch] + mod) % mod;
      sum[j] = (sum[j] + f[j][ch]) % mod;
    }
  }
  int ans = 0;
  for (register int i = 1; i <= n; i++) {
    ans = (ans + (long long)C(n - 1, i - 1) * sum[i] % mod) % mod;
  }
  printf("%d\n", ans);
  return 0;
}
