#include <bits/stdc++.h>
using namespace std;
int n, m;
char dqc, s[5005], t[5005];
long long c[5005][5005], dp[5005][30], sum[5005];
const long long mod = 1e9 + 7;
int main() {
  dqc = '-';
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (int i = 1; i <= n; ++i) {
    if (s[i] != dqc) {
      ++m;
      t[m] = s[i];
      dqc = s[i];
    }
  }
  c[0][0] = 1;
  for (int i = 1; i <= 5000; ++i) {
    c[i][0] = 1;
    for (int j = 1; j <= i; ++j)
      c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
  }
  sum[0] = 1;
  for (int i = 1; i <= m; ++i) {
    for (int j = i; j >= 1; --j) {
      long long dq;
      dq =
          (sum[j - 1] - dp[j - 1][t[i] - 'a'] - dp[j][t[i] - 'a'] + mod + mod) %
          mod;
      dp[j][t[i] - 'a'] += dq, dp[j][t[i] - 'a'] %= mod;
      sum[j] += dq, sum[j] %= mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= m; ++i) {
    long long dq = sum[i] * c[n - 1][i - 1] % mod;
    ans += dq;
    ans %= mod;
  }
  printf("%I64d\n", ans);
  return 0;
}
