#include <bits/stdc++.h>
const int MAXN = 5000 + 15;
const long long MOD = 1e9 + 7;
int dp[MAXN][MAXN] = {0};
int cnk[MAXN][MAXN] = {0};
bool used[MAXN][MAXN] = {false};
long long count(int n, int k) {
  if (k == 0 || n == k) {
    return 1;
  }
  if (used[n][k]) return cnk[n][k];
  used[n][k] = true;
  long long a = count(n - 1, k - 1);
  long long b = count(n - 1, k);
  long long c = (a + b + MOD) % MOD;
  cnk[n][k] = (int)c;
  return cnk[n][k];
}
int main() {
  int n = 0;
  std::cin >> n;
  std::string s;
  std::cin >> s;
  int dpSum[MAXN] = {0};
  for (int i = 0; i < n; i++) {
    int sym = s[i] - 'a';
    if (!dp[sym][1]) {
      dpSum[1] = (1ll + dpSum[1] + MOD) % MOD;
      dp[sym][1] = 1;
    }
    for (int l = i + 1; l >= 2; l--) {
      long long tmp = dp[sym][l];
      dp[sym][l] = (0ll + dpSum[l - 1] - dp[sym][l - 1] + MOD) % MOD;
      dpSum[l] = (0ll + dpSum[l] + dp[sym][l] - tmp) % MOD;
    }
  }
  long long ans = 0;
  for (int l = 1; l <= n; l++) {
    long long sum = 0;
    for (int j = 0; j <= 25; j++) {
      sum = (sum + dp[j][l]) % MOD;
    }
    if (sum) {
      ans = (ans + sum * count(n - 1, l - 1)) % MOD;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
