#include <bits/stdc++.h>
using namespace std;
const int maxn = 5003;
const int mod = (int)1e9 + 7;
int dp[maxn][26], dps[maxn], un[maxn], c[maxn][maxn];
void norm(int &x) {
  if (x < 0) {
    x += mod;
  } else if (x >= mod) {
    x -= mod;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int i = 0; i < maxn; ++i) c[i][0] = 1;
  for (int i = 1; i < maxn; ++i) {
    for (int j = 1; j < maxn; ++j) {
      c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
      if (c[i][j] > mod) c[i][j] -= mod;
    }
  }
  string s;
  int n, m = 0, ans = 0;
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    while (i + 1 != n && s[i] == s[i + 1]) ++i;
    un[++m] = s[i] - 'a';
  }
  dps[0] = 1;
  for (int lst = 1; lst <= m; ++lst) {
    int ch = un[lst];
    for (int len = 1; len <= lst; ++len) {
      dps[len] -= dp[len][ch];
      dp[len][ch] = dps[len - 1] - dp[len - 1][ch];
      norm(dp[len][ch]);
      dps[len] += dp[len][ch];
      norm(dps[len]);
    }
  }
  for (int len = 1; len <= m; ++len) {
    ans = ((signed long long int)ans +
           (signed long long int)dps[len] *
               (signed long long int)c[n - 1][len - 1]) %
          mod;
  }
  cout << ans << endl;
  return 0;
}
