#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 5000 + 10, MAX_C = 26 + 4, P = 1e9 + 7;
int n, a[MAX_N], C[MAX_N][MAX_N], dp[MAX_C][MAX_N];
void readInput() {
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; i++) a[i] = s[i] - 'a';
}
void solve() {
  for (int i = 0; i < n; i++) C[i][0] = C[i][i] = 1;
  for (int i = 1; i < n; i++)
    for (int j = 1; j < i; j++) C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % P;
  for (int i = 0; i < n; i++) {
    memset(dp[a[i]], 0, sizeof dp[a[i]]);
    dp[a[i]][0] = 1;
    for (int j = 0; j < MAX_C; j++)
      if (j != a[i])
        for (int k = 0; k < n; k++) (dp[a[i]][k + 1] += dp[j][k]) %= P;
  }
  int ans = 0;
  for (int i = 0; i < MAX_C; i++)
    for (int j = 0; j < n; j++) (ans += 1LL * C[n - 1][j] * dp[i][j] % P) %= P;
  cout << ans << endl;
}
int main() {
  ios_base ::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  readInput(), solve();
  return 0;
}
