#include <bits/stdc++.h>
using namespace std;
const long long N = 5005;
const long long mod = 1e9 + 7;
long long dp[26][N];
long long dpsum[N];
long long n;
long long fact[N];
long long inv[N];
char buf[N];
vector<long long> colors;
long long powmod(long long a, long long b) {
  long long res = 1ll;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1ll) {
    if (b & 1ll) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
void pre() {
  fact[0] = 1, inv[0] = 1;
  for (long long i = 1; i < N; i++) {
    fact[i] = fact[i - 1] * i;
    inv[i] = powmod(fact[i], mod - 2);
    fact[i] %= mod;
  }
}
long long choose(long long a, long long b) {
  long long res = 1;
  res *= fact[a];
  res %= mod;
  res *= inv[b];
  res %= mod;
  res *= inv[a - b];
  res %= mod;
  return res;
}
int main() {
  scanf("%I64d", &n);
  scanf("%s", buf + 1);
  pre();
  long long start = 1;
  while (start <= n) {
    while (buf[start] == buf[start + 1] and start < n) {
      start++;
    }
    colors.emplace_back(buf[start] - 'a');
    start++;
  }
  long long ans = 0;
  dpsum[0] = 1;
  for (long long i = 0; i < colors.size(); i++) {
    long long cur = colors[i];
    for (long long j = 1; j <= colors.size(); j++) {
      dpsum[j] -= (dp[cur][j]);
      dp[cur][j] = (dpsum[j - 1] - dp[cur][j - 1]);
      dp[cur][j] %= mod;
      dpsum[j] += (dp[cur][j]);
      dpsum[j] += mod;
      dpsum[j] %= mod;
    }
  }
  for (long long i = 1; i <= colors.size(); i++) {
    ans += dpsum[i] * choose(n - 1, i - 1);
    ans %= mod;
  }
  printf("%I64d", ans);
}
