#include <bits/stdc++.h>
using namespace std;
int n;
string s;
long long getinv(int x) {
  long long b = x, r = 1, p = ((long long)(1e9 + 7)) - 2;
  while (p) {
    if (p & 1) r = (r * b) % ((long long)(1e9 + 7));
    b = (b * b) % ((long long)(1e9 + 7));
    p /= 2;
  }
  return r;
}
long long invFac[5010], inv[5010], fac[5010];
long long dp[5010][5010];
inline long long ncr(int a, int b) {
  return (((fac[a] * invFac[b]) % ((long long)(1e9 + 7))) * invFac[a - b]) %
         ((long long)(1e9 + 7));
}
int main() {
  cin >> n >> s;
  for (auto &i : s) i -= 'a';
  for (int i = 1; i <= n; i++) inv[i] = getinv(i);
  fac[0] = 1;
  for (int i = 1; i <= n; i++)
    fac[i] = (fac[i - 1] * i) % ((long long)(1e9 + 7));
  invFac[0] = 1;
  for (int i = 1; i <= n; i++)
    invFac[i] = (invFac[i - 1] * inv[i]) % ((long long)(1e9 + 7));
  long long res = 0;
  long long val[26][5010]{};
  long long tot[5010]{};
  tot[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= i; j++) {
      long long v = (tot[j] - val[s[i]][j]) % ((long long)(1e9 + 7));
      if (v < 0) v += ((long long)(1e9 + 7));
      dp[i][j + 1] += v;
      dp[i][j + 1] %= ((long long)(1e9 + 7));
      res += (v * ncr(n - 1, j)) % ((long long)(1e9 + 7));
      res %= ((long long)(1e9 + 7));
    }
    for (int j = 0; j <= n; j++) {
      tot[j] += dp[i][j];
      tot[j] %= ((long long)(1e9 + 7));
      if (tot[j] < 0) tot[j] += ((long long)(1e9 + 7));
    }
    for (int j = 0; j <= n; j++) val[s[i]][j] = tot[j];
  }
  cout << res << endl;
  return 0;
}
