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>
const int N = 5000 + 100;
const int M = 1e5 + 100;
const long long mod = 1e9 + 7;
const double EPS = 1e-9;
using namespace std;
int base[N], n, tot;
char s[N];
long long dp[N][30], sum[N], C[N][N];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; i++) {
    if (tot == 0)
      base[++tot] = s[i] - 'a';
    else if (base[tot] != s[i] - 'a')
      base[++tot] = s[i] - 'a';
  }
  for (int i = 1; i <= tot; i++) {
    int x = base[i];
    for (int j = i; j >= 2; j--) {
      long long r = (sum[j - 1] - dp[j - 1][x] - dp[j][x] + mod) % mod;
      dp[j][x] = (dp[j][x] + r) % mod;
      sum[j] = (sum[j] + r) % mod;
    }
    if (dp[1][x] == 0) dp[1][x] = 1, sum[1] = (1 + sum[1]) % mod;
  }
  for (int i = 0; i <= n; i++) {
    C[i][0] = 1;
    for (int j = 1; j <= i; j++)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  }
  long long ans = 0;
  for (int i = 1; i <= tot; i++)
    ans = (ans + (long long)C[n - 1][i - 1] * sum[i] % mod) % mod;
  printf("%lld\n", (ans % mod + mod) % mod);
  return 0;
}
