#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5e3 + 10;
const int MOD = 1e9 + 7;
int n;
char s[MAX_N];
int dp[26][MAX_N];
int sum[MAX_N];
int cb[MAX_N][MAX_N];
int main() {
  int i, l, j;
  scanf("%d", &n);
  scanf("%s", s + 1);
  cb[0][0] = 1;
  for (i = 1; i <= n; i++) {
    cb[i][0] = 1;
    for (j = 1; j <= i; j++) {
      cb[i][j] = cb[i - 1][j - 1] + cb[i - 1][j];
      if (cb[i][j] >= MOD) cb[i][j] -= MOD;
    }
  }
  s[i] = '#';
  for (i = 1; i <= n; i++) {
    if (s[i] == s[i - 1]) continue;
    if (!dp[s[i] - 'a'][1]) {
      dp[s[i] - 'a'][1] = 1;
      sum[1]++;
    }
    for (l = 2; l <= n; l++) {
      sum[l] -= dp[s[i] - 'a'][l];
      if (sum[l] < 0) sum[l] += MOD;
      dp[s[i] - 'a'][l] = sum[l - 1] - dp[s[i] - 'a'][l - 1];
      if (dp[s[i] - 'a'][l] < 0) dp[s[i] - 'a'][l] += MOD;
      sum[l] += dp[s[i] - 'a'][l];
      if (sum[l] >= MOD) sum[l] -= MOD;
    }
  }
  int ans = 0;
  for (i = 1; i <= n; i++) {
    ans += (long long)((long long)sum[i] * (long long)cb[n - 1][i - 1]) % MOD;
    if (ans >= MOD) ans -= MOD;
  }
  printf("%d\n", ans);
  return 0;
}
