#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long mpow(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n /= 2;
  }
  return res;
}
const int N = 5005;
long long d[N][26];
long long sum[N];
vector<long long> fac(N, 1);
vector<long long> invfac(N, 1);
int main() {
  for (int i = 1; i < fac.size(); ++i) {
    fac[i] = fac[i - 1] * i % mod;
    invfac[i] = mpow(fac[i], mod - 2);
  }
  int n;
  string s;
  cin >> n >> s;
  sum[0] = 1;
  for (int i = 0; i < n; ++i) {
    int t = s[i] - 'a';
    for (int k = 0; k <= i; ++k) {
      long long nd = sum[k] - d[k][t];
      sum[k + 1] = (sum[k + 1] - d[k + 1][t] + nd) % mod;
      d[k + 1][t] = nd;
    }
  }
  long long res = 0;
  for (int k = 1; k <= n; ++k) {
    res = (res +
           sum[k] * fac[n - 1] % mod * invfac[k - 1] % mod * invfac[n - k]) %
          mod;
  }
  cout << (res % mod + mod) % mod << endl;
  return 0;
}
