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;
const double eps = 1e-10;
const double pi = 3.1415926535897932384626433832795;
const double eln = 2.718281828459045235360287471352;
const long long mod = 1e9 + 7;
long long sum[5005];
bool b[27];
long long c[5005];
char s[5005], s1[5005];
long long dp[5005][27];
int i, j, k, l, m, n;
long long ans;
long long mi(long long x, long long y) {
  long long aa = 1;
  while (y > 0) {
    if (y & 1) aa = (aa * x) % mod;
    x = (x * x) % mod;
    y >>= 1;
  }
  return aa;
}
int main() {
  scanf("%d\n", &n);
  if (n - 1 <= 1)
    c[0] = c[1] = 1;
  else {
    l = n - 1;
    c[0] = 1;
    c[1] = l;
    for (i = 2; i <= l; i++) {
      c[i] = c[i - 1];
      c[i] *= (long long)(l - i + 1);
      c[i] %= mod;
      c[i] *= mi((long long)i, mod - 2);
      c[i] %= mod;
    }
  }
  gets(s1 + 1);
  m = 1;
  s[1] = s1[1];
  for (i = 2; i <= n; i++)
    if (s1[i] != s1[i - 1]) s[++m] = s1[i];
  memset(b, 0, sizeof(b));
  for (i = 1; i <= m; i++) {
    int t = s[i] - 96;
    if (!b[t]) {
      sum[1]++;
      dp[1][t] = 1;
      b[t] = true;
    }
    for (k = 2; k <= m; k++) {
      long long t1 = (sum[k - 1] - dp[k - 1][t] + mod) % mod;
      long long t2 = dp[k][t];
      dp[k][t] = t1;
      sum[k] = (sum[k] + mod + t1 - t2) % mod;
    }
  }
  for (i = 1; i <= m; i++) {
    ans += (sum[i] * c[i - 1]) % mod;
    ans %= mod;
  }
  printf("%lld", ans);
  return 0;
}
