#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long num = 0, neg = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    num = (num << 3) + (num << 1) + c - '0';
    c = getchar();
  }
  return num * neg;
}
const long long mod = 1e9 + 7;
char str[5010];
long long fac[5010], inv[5010], n;
long long f[30][5010], tot[5010], ans;
long long sum[30][5010];
inline long long qpow(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) res = res * x % mod;
    x = x * x % mod;
    k >>= 1;
  }
  return res;
}
inline long long C(long long n, long long m) {
  if (n == m || m == 0) return 1;
  return fac[n] * inv[m] % mod * inv[n - m] % mod;
}
signed main() {
  n = read();
  scanf("%s", str + 1);
  fac[0] = inv[0] = 1;
  for (long long i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % mod;
  inv[n] = qpow(fac[n], mod - 2);
  for (long long i = n - 1; i >= 1; i--) inv[i] = inv[i + 1] * (i + 1) % mod;
  tot[0] = 1;
  for (long long i = 1; i <= n; i++) {
    long long u = str[i] - 'a';
    for (long long j = i; j >= 1; j--) {
      f[u][j] = ((tot[j - 1] - sum[u][j - 1]) % mod + mod) % mod;
      tot[j] = ((tot[j] + f[u][j] - sum[u][j]) % mod + mod) % mod;
      sum[u][j] = f[u][j];
    }
  }
  for (long long i = 1; i <= n; i++)
    ans = (ans + tot[i] * C(n - 1, i - 1) % mod) % mod;
  cout << ans << endl;
  return 0;
}
