#include <bits/stdc++.h>
using namespace std;
template <class T>
using vec = vector<T>;
template <typename Iter>
ostream &_IterOutput_(ostream &o, Iter b, Iter e, const string ss = "",
                      const string se = "") {
  o << ss;
  for (auto it = b; it != e; it++) o << (it == b ? "" : ", ") << *it;
  return o << se;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &o, const pair<T1, T2> &pair) {
  return o << "(" << pair.first << ", " << pair.second << ")";
}
template <typename T>
ostream &operator<<(ostream &o, const vector<T> &vec) {
  return _IterOutput_(o, begin(vec), end(vec), "[", "]");
}
template <typename T>
ostream &operator<<(ostream &o, const set<T> &st) {
  return _IterOutput_(o, begin(st), end(st), "{", "}");
}
template <typename T, size_t N>
ostream &operator<<(ostream &o, const array<T, N> &arr) {
  return _IterOutput_(o, begin(arr), end(arr), "|", "|");
}
template <typename T1, typename T2>
ostream &operator<<(ostream &o, const map<T1, T2> &mp) {
  o << "{";
  for (auto it = mp.begin(); it != mp.end(); it++) {
    o << (it == mp.begin() ? "" : ", ") << it->first << ":" << it->second;
  }
  o << "}";
  return o;
}
void lucky_test() {
  std::random_device rd;
  std::mt19937 gen_(rd());
  std::normal_distribution<double> dist_(0.0, 1.0);
  if (dist_(gen_) >= 4.44444444) {
    cout << "Not lucky" << endl;
    exit(0);
  }
}
const long long MX = 5555;
const long long MD = 1000000007;
long long N;
long long second[MX];
long long nx[MX][26];
long long bk[MX][26];
long long fac[MX], invfac[MX];
long long C(long long n, long long m) {
  if (m == n or m == 0) return 1;
  if (m > n or m < 0) return 0;
  return fac[n] * invfac[m] % MD * invfac[n - m] % MD;
}
long long fp(long long a, long long b) {
  if (!b) return 1 % MD;
  long long ret = fp(a * a % MD, b / 2);
  if (b & 1) ret = ret * a % MD;
  return ret;
}
void init() {
  fac[0] = 1;
  for (long long i = 1; i < MX; i++) {
    fac[i] = fac[i - 1] * i % MD;
    invfac[i] = fp(fac[i], MD - 2);
  }
}
long long hao[MX][MX];
int32_t main() {
  do {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  } while (0);
  init();
  cin >> N;
  string s;
  cin >> s;
  for (long long i = 1; i <= N; i++) second[i] = s[i - 1] - 'a';
  for (long long i = 0; i < 26; i++) nx[N][i] = -1;
  for (long long i = N - 1; i >= 0; i--) {
    for (long long j = 0; j < 26; j++) nx[i][j] = nx[i + 1][j];
    nx[i][second[i + 1]] = i + 1;
  }
  for (long long i = 0; i < 26; i++) bk[1][i] = -1;
  for (long long i = 2; i <= N; i++) {
    for (long long j = 0; j < 26; j++) bk[i][j] = bk[i - 1][j];
    bk[i][second[i - 1]] = i - 1;
  }
  hao[1][0] = 1;
  long long ans = 0;
  for (long long i = 1; i <= N; i++) {
    long long t = bk[i][second[i]];
    hao[i + 1][0] = hao[i][0];
    for (long long j = 1; j <= N; j++) {
      hao[i + 1][j] = (hao[i][j] + hao[i][j - 1] - hao[t + 1][j - 1] + MD) % MD;
    }
  }
  for (long long i = 1; i <= N; i++) {
    ans += C(N - 1, i - 1) * hao[N + 1][i];
    ans %= MD;
  }
  cout << ans << endl;
  return 0;
}
