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 N = 5001;
int n, C[N][N], mod = 1e9 + 7;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  C[0][0] = 1;
  for (int i = 1; i < N; i++) {
    C[i][0] = 1;
    for (int j = 1; j < N; j++) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
  cin >> n >> s;
  vector<vector<int> > dp(26, vector<int>(n + 1));
  vector<int> tot(n + 1);
  for (auto &c : s) {
    int idx = c - 'a';
    for (int i = 1; i <= n; i++) tot[i] = (tot[i] - dp[idx][i] + mod) % mod;
    for (int i = 2; i <= n; i++) dp[idx][i] = tot[i - 1];
    dp[idx][1] = 1;
    for (int i = 1; i <= n; i++) tot[i] = (tot[i] + dp[idx][i]) % mod;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    ans = (ans + 1LL * C[n - 1][i - 1] * tot[i]) % mod;
  cout << ans << endl;
}
