#include <bits/stdc++.h>
using namespace std;
const int N = 5050;
int n;
char s[N];
int C[N][N], dp[N][30];
const int mo = 1e9 + 7;
int main() {
  scanf("%d", &n);
  C[0][0] = 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]) % mo;
  scanf("%s", s + 1);
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = i; j >= 1; --j) {
      int ret = 0;
      for (int k = 0; k <= 26; ++k)
        if (k != s[i] - 'a' + 1) (ret += dp[j - 1][k]) %= mo;
      dp[j][s[i] - 'a' + 1] = ret;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    int ret = 0;
    for (int j = 1; j <= 26; ++j) (ret += dp[i][j]) %= mo;
    (ans += 1ll * C[n][i] * ret % mo) %= mo;
  }
  printf("%d\n", ans);
}
