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;
long long gcdex(long long a, long long b, long long &x, long long &y) {
  if (a == 0) {
    x = 0;
    y = 1;
    return b;
  }
  long long x1, y1;
  long long d = gcdex(b % a, a, x1, y1);
  x = y1 - (b / a) * x1;
  y = x1;
  return d;
}
long long inverse(int a, int m) {
  long long x, y;
  long long g = gcdex(a, m, x, y);
  return (x % m + m) % m;
}
int main() {
  long long mod = 1e9 + 7;
  int N = 5010;
  long long fak[N];
  fak[0] = 1;
  for (int i = 1; i < N; i++) fak[i] = (fak[i - 1] * i) % mod;
  int n;
  cin >> n;
  string s;
  cin >> s;
  long long p[n][n + 1];
  long long sum[n + 1];
  for (int j = 1; j <= n; j++) sum[j] = 0;
  int last[26];
  for (int j = 0; j < 26; j++) last[j] = -1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= n; j++) p[i][j] = 0;
    p[i][1] = 1;
    for (int j = 1; j < n; j++) {
      p[i][j + 1] = sum[j];
      if (last[s[i] - 'a'] != -1)
        p[i][j + 1] = (p[i][j + 1] - p[last[s[i] - 'a']][j] + mod) % mod;
    }
    for (int j = 1; j <= n; j++) {
      sum[j] = (sum[j] + p[i][j]) % mod;
      if (last[s[i] - 'a'] != -1)
        sum[j] = (sum[j] - p[last[s[i] - 'a']][j] + mod) % mod;
    }
    last[s[i] - 'a'] = i;
  }
  long long res = 0;
  for (int k = 1; k <= n; k++) {
    long long add = (fak[n - 1] * inverse(fak[k - 1], mod)) % mod;
    add = (add * inverse(fak[n - k], mod)) % mod;
    res = (res + add * sum[k]) % mod;
  }
  cout << res << endl;
}
