#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const long long mn = 5004, mc = 26;
long long mod_pow(long long a, long long n, long long mod) {
  long long ret = 1;
  long long p = a % mod;
  while (n) {
    if (n & 1) ret = ret * p % mod;
    p = p * p % mod;
    n >>= 1;
  }
  return ret;
}
const long long MAXFACT = mn * 3;
long long fact[MAXFACT + 1], invfact[MAXFACT + 1];
inline long long mul(long long x, long long y) { return (x * y) % MOD; }
inline long long add(long long x, long long y) { return (x + y) % MOD; }
void init() {
  long long got = 1;
  for (long long x = 0; x <= MAXFACT; x++) {
    fact[x] = got;
    got = mul(got, x + 1);
  }
  got = mod_pow(got, MOD - 2, MOD);
  for (long long x = MAXFACT; x >= 0; x--) {
    got = mul(got, x + 1);
    invfact[x] = got;
    assert(mul(fact[x], invfact[x]) == 1);
  }
}
long long binom(long long n, long long k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return mul(fact[n], mul(invfact[k], invfact[n - k]));
}
long long starbar(long long stars, long long parts) {
  if (parts == 0) {
    return (stars == 0) ? 1 : 0;
  }
  if (parts <= 0 || stars < 0) return 0;
  return binom(stars + parts - 1, parts - 1);
}
long long f[mn][mn];
long long lastsum[mc][mn];
long long currentsum[mn];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  init();
  long long n;
  string s;
  cin >> n >> s;
  memset(lastsum, 0, sizeof lastsum);
  memset(currentsum, 0, sizeof currentsum);
  memset(f, 0, sizeof f);
  f[0][0] = 1;
  {
    long long x = 0;
    for (long long k = 0; k < n; k++) {
      currentsum[k + 1] += f[x][k];
    }
  }
  for (long long x = 1; x <= n; x++) {
    for (long long k = 0; k <= n; k++) f[x][k] = f[x - 1][k];
    long long c = s[x - 1] - 'a';
    for (long long k = n; k >= 0; k--) {
      long long toadd = (currentsum[k] - lastsum[c][k] + MOD) % MOD;
      f[x][k] += toadd;
      f[x][k] %= MOD;
      currentsum[k + 1] += toadd;
      currentsum[k + 1] %= MOD;
      lastsum[c][k] = currentsum[k];
      lastsum[c][k + 1] = currentsum[k + 1];
    }
  }
  long long final = 0;
  for (long long k = 0; k <= n; k++) {
    final += mul(f[n][k], starbar(n - k, k));
  }
  final %= MOD;
  printf("%lld\n", final);
}
