#include <bits/stdc++.h>
using namespace std;
const int MAX_n = 5000, SGM = 26, MOD = 1000 * 1000 * 1000 + 7;
char str[MAX_n + 1];
int sum[MAX_n + 1];
int dp[MAX_n + 1][SGM];
int add(int a, int b) { return (a + b) % MOD; }
int pow(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = (long long)ret * a % MOD;
    a = (long long)a * a % MOD, b >>= 1;
  }
  return ret;
}
int main() {
  int n;
  scanf("%d %s", &n, str);
  sum[0] = 1;
  for (int i = 0; i < n; ++i) {
    int c = str[i] - 'a';
    for (int j = 1; j <= i + 1; ++j) {
      int delta = add(sum[j - 1], -add(dp[j - 1][c], dp[j][c]));
      dp[j][c] = add(dp[j][c], delta);
      sum[j] = add(sum[j], delta);
    }
  }
  long long C = 1;
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans = add(ans, C * sum[i] % MOD);
    C = C * (n - i) % MOD * pow(i, MOD - 2) % MOD;
  }
  ans = (ans + MOD) % MOD;
  printf("%d\n", ans);
}
