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 int N = 5010;
const int M = 300100;
const int INF = 0x3f3f3f3f;
const int mod = 1000000007;
void MOD(long long &a) {
  if (a >= mod) a -= mod;
}
void MOD(long long &a, long long c) {
  if (a >= c) a -= c;
}
void ADD(long long &a, long long b) {
  a += b;
  MOD(a);
}
void ADD(long long &a, long long b, long long c) {
  a += b;
  MOD(a, c);
}
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a;
    a = a * a;
    b /= 2;
  }
  return ans;
}
long long qpow(long long a, long long b, long long c) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % c;
    a = a * a % c;
    b /= 2;
  }
  return ans;
}
int n, c[N][N], dp[N][N], last[26];
char s[N];
int main() {
  scanf("%d%s", &n, s + 1);
  for (int i = (c[0][0] = 1); i <= n; i++)
    for (int j = (c[i][0] = 1); j <= i; j++)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= n; j++) dp[i][j] = dp[i - 1][j];
    for (int j = 1; j <= n; j++) {
      if (last[s[i] - 'a'])
        dp[i][j] += dp[i - 1][j - 1] - dp[last[s[i] - 'a']][j - 1];
      else
        dp[i][j] += dp[i - 1][j - 1];
      dp[i][j] %= mod;
      dp[i][j] += mod;
      dp[i][j] %= mod;
    }
    last[s[i] - 'a'] = i;
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    ans = (ans + 1ll * c[n - 1][i - 1] * dp[n][i]) % mod;
  printf("%lld\n", ans);
}
