#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
int dp[5015][27], fac[5015 * 2], inv[5015 * 2];
char s[5015];
void init() {
  fac[0] = inv[0] = 1;
  for (int(i) = 1; (i) <= (int)(n + n); (i)++) {
    fac[i] = (long long)fac[i - 1] * i % 1000000007;
    inv[i] = fastPow(fac[i], 1000000007 - 2);
  }
}
int C(int n, int m) {
  if (n < m) return 0;
  return (long long)fac[n] * inv[m] % 1000000007 * inv[n - m] % 1000000007;
}
void fmain(int tid) {
  scanf("%d", &n);
  scanf("%s", s + 1);
  init();
  dp[0][26] = 1;
  for (int(i) = 1; (i) <= (int)(n); (i)++) {
    if (s[i] == s[i - 1]) continue;
    int num = s[i] - 'a';
    for (int j = i - 1; j >= 0; j--) {
      addmod(dp[j + 1][26], 1000000007 - dp[j + 1][num]);
      dp[j + 1][num] = 0;
      int ss = dp[j][26] - dp[j][num];
      addmod(ss, 1000000007);
      addmod(dp[j + 1][num], ss);
      addmod(dp[j + 1][26], ss);
    }
  }
  int ans = 0;
  for (int(j) = 1; (j) <= (int)(n); (j)++) {
    int ss = dp[j][26];
    addmod(ans, (long long)C(n - 1, j - 1) * ss % 1000000007);
  }
  printf("%d\n", ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
