#include <bits/stdc++.h>
int add(int a, int b) { return (a + b) % ((long long)1e9 + 7); }
int main() {
  static char s[5000 + 1];
  static int choose[5000 + 1][5000 + 1], dp[5000][5000 + 1], next[5000][26];
  int n, c, i, j, cnt;
  scanf("%d", &n);
  scanf("%s", s);
  for (c = 0; c < 26; c++) next[n - 1][c] = s[n - 1] == c + 'a' ? n - 1 : -1;
  for (i = n - 2; i >= 0; i--)
    for (c = 0; c < 26; c++) next[i][c] = s[i] == c + 'a' ? i : next[i + 1][c];
  for (c = 0; c < 26; c++)
    if (next[0][c] >= 0) dp[next[0][c]][1] = 1;
  for (i = 0; i < n; i++)
    for (j = 1; j < n; j++)
      if (dp[i][j] > 0)
        for (c = 0; c < 26; c++)
          if (s[i] != c + 'a') {
            int i_ = next[i][c];
            if (i_ >= 0) dp[i_][j + 1] = add(dp[i_][j + 1], dp[i][j]);
          }
  for (i = 0; i <= n; i++) {
    choose[i][0] = 1;
    for (j = 1; j <= i; j++)
      choose[i][j] = add(choose[i - 1][j], choose[i - 1][j - 1]);
  }
  cnt = 0;
  for (j = 1; j <= n; j++) {
    for (i = 1; i < n; i++) dp[i][j] = add(dp[i - 1][j], dp[i][j]);
    cnt = add(cnt, (long long)dp[n - 1][j] * choose[n - 1][j - 1] %
                       ((long long)1e9 + 7));
  }
  printf("%d\n", cnt);
  return 0;
}
