#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long res;
int n, nn;
int c[5001][5001];
vector<vector<int> > sum;
vector<int> p, d;
string s;
void f() {
  string t = s;
  s = t[0];
  for (int i = 1; i < t.length(); ++i)
    if (t[i] != t[i - 1]) s += t[i];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> s;
  nn = n;
  f();
  n = s.length();
  for (int i = 0; i < 5001; ++i) c[i][i] = c[i][0] = 1;
  for (int i = 2; i < 5001; ++i) {
    for (int j = 1; j < i; ++j) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
      if (c[i][j] >= mod) c[i][j] -= mod;
    }
  }
  p.assign(26, -1);
  d.assign(n + 1, 0);
  sum.assign(n + 1, vector<int>(n + 1, 0));
  sum[0][0] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) d[j + 1] = sum[i][j];
    int h = p[int(s[i] - 'a')];
    if (h != -1) {
      for (int j = 0; j < n; ++j) {
        d[j + 1] = d[j + 1] + (mod - sum[h + 1][j]);
        if (d[j + 1] >= mod) d[j + 1] -= mod;
      }
    }
    for (int j = 0; j < n + 1; ++j) {
      sum[i + 1][j] = sum[i][j] + d[j];
      if (sum[i + 1][j] >= mod) sum[i + 1][j] -= mod;
    }
    p[int(s[i] - 'a')] = i;
  }
  res = 0;
  for (int j = 1; j < n + 1; ++j)
    res = (res + sum[n][j] * (long long)c[nn - 1][nn - j]) % mod;
  cout << res << endl;
  return 0;
}
