#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
const int mod = 1000000007;
int n;
string s;
int a[N];
int d[30][N];
int c[N][N];
void add(int &x, int y) {
  if ((x += y) >= mod) x -= mod;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  cin >> s;
  c[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    c[i][0] = c[i][i] = 1;
    for (int j = 1; j < i; ++j) {
      c[i][j] = c[i - 1][j - 1];
      add(c[i][j], c[i - 1][j]);
    }
  }
  string t = "";
  for (int i = 0; i < n; ++i)
    if (!i || s[i] != s[i - 1]) t += s[i];
  int m = t.length();
  for (int i = 0; i < m; ++i) a[i] = t[i] - 'a';
  for (int i = 0; i < m; ++i) {
    d[a[i]][1] = 1;
    for (int len = i + 1; len >= 2; --len) {
      d[a[i]][len] = 0;
      for (int let = 0; let < 26; ++let)
        if (let != a[i]) add(d[a[i]][len], d[let][len - 1]);
    }
  }
  int res = 0;
  for (int let = 0; let < 26; ++let)
    for (int len = 1; len <= m; ++len) {
      add(res, d[let][len] * 1ll * c[n - 1][len - 1] % mod);
    }
  printf("%d\n", res);
  return 0;
}
