#include <bits/stdc++.h>
using namespace std;
const int maxn = 5003;
const int mod = (int)1e9 + 7;
int dp[maxn][26], dps[maxn], un[maxn], c[maxn][maxn], f[maxn], 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[len][ch];
      dp[len][ch] = dps[len - 1] - dp[len - 1][ch];
      norm(dp[len][ch]);
      dps[len] += dp[len][ch];
      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;
}
