15
txxtxttxxttxtxx
 3
myw
 127
xixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxixhxixtxixnxixtxixlxixtxixnxixtxixoxixtxixnxixtxixlxixtxixnxixtxix
 1
a
 10
isssisssss
 2
ff
 1
z

27824
 10
 944124121
 1
 176
 1
 1

#include <bits/stdc++.h>
using namespace std;
int N = 1000000007;
vector<vector<long long>> binom(5001, vector<long long>(5001));
void find_binom() {
  for (int i = 0; i < binom.size(); ++i) {
    for (int j = 0; j < binom[1].size(); ++j) {
      if (j <= i) {
        if (j == 0 || j == i) {
          binom[i][j] = 1;
        } else {
          binom[i][j] = binom[i - 1][j - 1] + binom[i - 1][j];
          binom[i][j] %= N;
        }
      }
    }
  }
}
int main() {
  find_binom();
  int n;
  cin >> n;
  string sl;
  cin >> sl;
  vector<vector<long long>> dt(30, vector<long long>(n));
  for (int i = 0; i < n; ++i) {
    int l = sl[i] - 'a';
    for (int j = 0; j <= i; ++j) {
      if (j == 0) {
        dt[l][j] = 1;
      } else {
        dt[l][j] = 0;
        for (int k = 0; k < 30; ++k) {
          if (k != l) {
            dt[l][j] += dt[k][j - 1];
          }
        }
      }
      dt[l][j] %= N;
    }
  }
  long long res = 0;
  for (int i = 0; i < 30; ++i) {
    for (int j = 0; j < n; ++j) {
      if (dt[i][j] > 0) {
        res += dt[i][j] * binom[n - 1][j];
        res %= N;
      }
    }
  }
  cout << res << "\n";
  return 0;
}
