15
txxtxttxxttxtxx
 3
myw
 127
xixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxixhxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxix
 1
a
 10
isssisssss
 2
ff
 1
z

27824
 10
 944124121
 1
 176
 1
 1

#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using vll = vector<LL>;
using LD = long double;
template <typename T>
void check(T& a, const T& b) {
  if (a >= b) {
    a %= b;
  }
}
template <typename T>
T gcd(T u, T v) {
  if (u == v) return u;
  if (u == 0) return v;
  if (v == 0) return u;
  if (~u & 1) {
    if (v & 1)
      return gcd(u >> 1, v);
    else
      return gcd(u >> 1, v >> 1) << 1;
  }
  if (~v & 1) return gcd(u, v >> 1);
  if (u > v) return gcd((u - v) >> 1, v);
  return gcd((v - u) >> 1, u);
}
LL mulmod(LL a, LL b, const LL& m) {
  LL q = (LL)(((LD)a * (LD)b) / (LD)m);
  LL r = a * b - q * m;
  if (r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T, typename S>
T expo(T e, S n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T powerL(T e, T n, const T& m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mulmod(x, p, m);
    p = mulmod(p, p, m);
    n >>= 1;
  }
  return x;
}
const LL MOD = (int)1e9 + 7;
int ncr[5001][5001], dp[27][5001], sum[5001];
template <typename T>
T operator+(T& a, T& b) {
  return (a + b - MOD >= 0) ? a + b + MOD : a + b;
}
template <typename T>
T operator-(T& a, T& b) {
  return (a - b < 0 ? a - b + MOD : a - b);
}
void pre() {
  ncr[0][0] = 1;
  for (int i = 1; i <= 5000; i++) {
    ncr[i][0] = ncr[i][i] = 1;
    for (int j = 1; j < i; j++) {
      ncr[i][j] = ncr[i - 1][j - 1] + ncr[i - 1][j];
    }
  }
}
string conv(string& s) {
  string temp = "";
  int n = (int)s.size();
  for (int i = 0; i < n; i++) {
    if (i < n - 1 && s[i] == s[i + 1]) continue;
    temp += s[i];
  }
  return temp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cerr.tie(NULL);
  ;
  pre();
  string s;
  int n;
  cin >> n >> s;
  s = conv(s);
  int n1 = (int)s.size();
  sum[0] = 1;
  for (int i = 0; i < n1; i++) {
    char c = s[i] - 'a';
    for (int j = 1; j <= n; j++) {
      sum[j] = (sum[j] - dp[c][j]);
      sum[j] = (sum[j] + sum[j - 1] - dp[c][j - 1]);
      dp[c][j] = sum[j - 1] - dp[c][j - 1];
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans = ans + ((1LL * (sum[i]) * (ncr[n - 1][i - 1])) % MOD);
  }
  cout << ans << '\n';
  return 0;
}
