#include <bits/stdc++.h>
using namespace std;
const int N = 5000 + 77, L = 26, Mod = 1000000007;
int n, A, dp[N][L], Sdp[N], C[N][N];
char S[N];
int main() {
  for (int i = 0; i < N; ++i) C[0][i] = C[i][i] = 1;
  for (int i = 1; i < N; ++i)
    for (int j = i + 1; j < N; ++j)
      C[i][j] = (C[i - 1][j - 1] + C[i][j - 1]) % Mod;
  scanf("%d %s", &n, S + 1);
  Sdp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    int c = S[i] - 'a';
    for (int t = i; t > 0; --t) {
      Sdp[t] = (Sdp[t] - dp[t][c] + Mod) % Mod;
      dp[t][c] = (Sdp[t - 1] - dp[t - 1][c]) % Mod;
      if (dp[t][c] < 0) dp[t][c] += Mod;
      Sdp[t] = (Sdp[t] + dp[t][c]) % Mod;
    }
  }
  for (int t = 1; t <= n; ++t) {
    int w = Sdp[t];
    w = w * 1ll * C[t - 1][n - 1] % Mod;
    A = (A + w) % Mod;
  }
  printf("%d\n", A);
  return 0;
}
