#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];
      if (C[i][j] >= mod) C[i][j] -= 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] -= dp[idx][i];
      if (tot[i] < 0) tot[i] += 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] += dp[idx][i];
      if (tot[i] >= mod) tot[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;
}
