#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 5050;
char s[SIZE];
long long fac[SIZE], inv[SIZE];
long long mypow(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % MOD;
    y >>= 1;
    x = x * x % MOD;
  }
  return res;
}
long long C(int x, int y) {
  if (y < 0 || y > x) return 0;
  return fac[x] * inv[y] % MOD * inv[x - y] % MOD;
}
void build() {
  assert(MOD >= SIZE);
  fac[0] = 1;
  for (int i = (1); i < (SIZE); ++i) fac[i] = fac[i - 1] * i % MOD;
  inv[SIZE - 1] = mypow(fac[SIZE - 1], MOD - 2);
  for (int i = SIZE - 2; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % MOD;
}
int lt[SIZE];
int dp[5001][5001], dp0[5001][5001];
void ADD(int &x, long long v) {
  x = (x + v) % MOD;
  if (x < 0) x += MOD;
}
int main() {
  build();
  int(n);
  scanf("%d", &n);
  scanf("%s", (s + 1));
  int m = 1;
  for (int i = 2; i <= n; i++) {
    if (s[i] != s[m]) s[++m] = s[i];
  }
  {
    int now[26];
    memset((now), -1, sizeof((now)));
    for (int i = (1); i < (m + 1); ++i) {
      if (now[s[i] - 'a'] != -1) {
        lt[i] = now[s[i] - 'a'];
      }
      now[s[i] - 'a'] = i;
    }
  }
  dp[0][0] = 1;
  for (int i = (1); i < (m + 1); ++i) {
    dp[i][0] = 1;
    for (int j = (1); j < (i + 1); ++j) {
      dp[i][j] = dp[i - 1][j];
      dp0[i][j] = dp[i - 1][j - 1];
      if (lt[i]) {
        ADD(dp0[i][j], -dp0[lt[i]][j - 1]);
      }
      ADD(dp[i][j], dp0[i][j]);
      ADD(dp[i][j], -dp0[lt[i]][j]);
    }
  }
  int an = 0;
  for (int i = (1); i < (m + 1); ++i) {
    if (!dp[m][i]) continue;
    ADD(an, dp[m][i] * C(n - 1, i - 1));
  }
  printf("%d\n", an);
  return 0;
}
