#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];
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;
    }
  }
  int n;
  cin >> n;
  string s;
  cin >> s;
  int m = 0;
  for (int i = 0; i < n; ++i) {
    while (i + 1 != n && s[i] == s[i + 1]) ++i;
    un[++m] = s[i] - 'a';
  }
  for (int lst = 1; lst <= m; ++lst) {
    int ch = un[lst];
    dp[1][ch] = 1;
    for (int len = 2; len <= lst; ++len) {
      dp[len][ch] = 0;
      for (int k = 0; k < 26; ++k) {
        if (k != ch) {
          dp[len][ch] += dp[len - 1][k];
          if (dp[len][ch] > mod) dp[len][ch] -= mod;
        }
      }
    }
  }
  int ans = 0;
  for (int len = 1; len <= m; ++len) {
    int sum = 0;
    for (int k = 0; k < 26; ++k) {
      sum += dp[len][k];
      if (sum > mod) sum -= mod;
    }
    ans =
        ((signed long long int)ans +
         (signed long long int)sum * (signed long long int)c[n - 1][len - 1]) %
        mod;
  }
  cout << ans << endl;
  return 0;
}
