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;
int n;
string s;
int ara[5005], after[5005], seen[30];
long long dp[2][5005];
int ncr[5005][5005];
long long BinomialCoefficient(int nn, int rr) {
  int &ret = ncr[nn][rr];
  if (ret != -1) return ret;
  if (rr == 0 || rr == nn) return ret = 1;
  return ret = (0LL + BinomialCoefficient(nn - 1, rr - 1) +
                BinomialCoefficient(nn - 1, rr)) %
               1000000007;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  cin >> s;
  char bef = '#';
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == bef) continue;
    ara[cnt++] = s[i] - 'a';
    bef = s[i];
  }
  for (int i = 0; i < 30; i++) seen[i] = cnt;
  memset(ncr, -1, sizeof(ncr));
  int cur = 0;
  for (int i = cnt - 1; i >= 0; i--) {
    after[i] = seen[ara[i]];
    dp[cur][i] = dp[cur][i + 1];
    dp[cur][i] += (after[i] == cnt) ? 1 : 0;
    seen[ara[i]] = i;
  }
  long long ans = dp[0][0];
  for (int i = 1; i < cnt; i++) {
    for (int j = 0; j <= cnt; j++) dp[cur ^ 1][j] = 0;
    for (int j = cnt - i - 1; j >= 0; j--) {
      dp[cur ^ 1][j] =
          (dp[cur][j + 1] - dp[cur][after[j]] + 1000000007) % 1000000007;
      dp[cur ^ 1][j] = (dp[cur ^ 1][j + 1] + dp[cur ^ 1][j]) % 1000000007;
    }
    cur ^= 1;
    long long tmp =
        (1LL * dp[cur][0] * BinomialCoefficient(n - 1, i)) % 1000000007;
    ans = (ans + tmp) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
