#include <bits/stdc++.h>
using namespace std;
const int max_n = 5000 + 10, MOD = 1e9 + 7;
int l[max_n];
int par[max_n][max_n], ans[max_n], en[max_n][max_n];
string s;
int n, m, sum;
bool mark['z' + 20];
void solve() {
  m = unique(s.begin(), s.end()) - s.begin(), s.resize(m);
  par[0][1] = 1;
  mark[s[0]] = 1;
  ans[1] = 1;
  for (int i = 1; i < m; i++) {
    int tmp = 0;
    tmp = 1 - mark[s[i]];
    par[i][1] = (par[i - 1][1] + 1 - mark[s[i]]), par[i][1] %= MOD;
    ans[1] += tmp;
    for (int j = 2; j <= m; j++) {
      tmp = par[i - 1][j - 1];
      if (mark[s[i]]) tmp -= par[l[s[i]]][j - 1], (tmp < 0 ? tmp += MOD : 0);
      par[i][j] = (par[i - 1][j] + (tmp %= MOD)) % MOD;
      ans[j] += tmp, ans[j] %= MOD;
    }
    mark[s[i]] = 1;
    l[s[i]] = i;
  }
}
void ent() {
  for (int i = 1; i < max_n; i++) {
    en[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      en[i][j] = (en[i - 1][j] + en[i - 1][j - 1]) % MOD;
    }
  }
}
int32_t main() {
  cin >> n;
  cin >> s;
  solve();
  ent();
  for (int i = 0; i <= n; i++) {
    sum += (1LL * en[n][i - 1] * (ans[i] % MOD)) % MOD, sum %= MOD;
  }
  cout << sum << endl;
  return 0;
}
