15
txxtxttxxttxtxx
 3
myw
 127
xixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxixhxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxix
 1
a
 10
isssisssss
 2
ff
 1
z

27824
 10
 944124121
 1
 176
 1
 1

#include <bits/stdc++.h>
using namespace std;
const int maxn = 5003;
const int mod = (int)1e9 + 7;
static __attribute__((aligned(16))) int dp[26][maxn];
static __attribute__((aligned(16))) int dps[maxn];
static __attribute__((aligned(16))) int un[maxn];
static __attribute__((aligned(16))) int f[maxn];
static __attribute__((aligned(16))) int rf[maxn];
void norm(int &x) {
  if (x < 0) {
    x += mod;
  } else if (x >= mod) {
    x -= mod;
  }
}
int bpow(int x, int p) {
  int res = 1;
  while (p) {
    if (p & 1)
      res = ((signed long long int)res * (signed long long int)x) % mod;
    x = ((signed long long int)x * (signed long long int)x) % mod;
    p >>= 1;
  }
  return res;
}
inline int comb(int n, int k) {
  return ((((signed long long int)f[n] * (signed long long int)rf[k]) % mod) *
          (signed long long int)rf[n - k]) %
         mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  f[0] = f[1] = rf[0] = rf[1] = 1;
  for (int i = 2; i < maxn; ++i) {
    f[i] = ((signed long long int)f[i - 1] * (signed long long int)i) % mod;
    rf[i] = bpow(f[i], mod - 2);
  }
  string s;
  int n, m = 0, ans = 0;
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    while (i + 1 != n && s[i] == s[i + 1]) ++i;
    un[++m] = s[i] - 'a';
  }
  dps[0] = 1;
  for (int lst = 1; lst <= m; ++lst) {
    int ch = un[lst];
    for (int len = 1; len <= lst; ++len) {
      dps[len] -= dp[ch][len];
      dp[ch][len] = dps[len - 1] - dp[ch][len - 1];
      norm(dp[ch][len]);
      dps[len] += dp[ch][len];
      norm(dps[len]);
    }
  }
  for (int len = 1; len <= m; ++len) {
    ans = ((signed long long int)ans +
           (signed long long int)dps[len] *
               (signed long long int)comb(n - 1, len - 1)) %
          mod;
  }
  cout << ans << endl;
  return 0;
}
