#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 1000 + 10;
const int maxn5 = 1 * 1000 * 100 + 10;
const int maxn3 = 200 + 10;
const long long mod = 1000 * 1000 * 1000 + 7;
const long long inf = 1LL * 2 * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 10;
long long ps[maxn5], last[30], dp[maxn5], fact[maxn5];
long long pw(long long a, long long b) {
  return (b == 0 ? 1LL
                 : ((pw(a * a % mod, b / 2) * (b & 1 == 1 ? a : 1LL)) % mod));
}
long long cmb(long long n, long long k) {
  return (fact[n] * pw(fact[k] * fact[n - k] % mod, mod - 2) % mod);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fact[0] = 1;
  for (int i = 1; i < maxn5; i++) fact[i] = fact[i - 1] * i % mod;
  int n;
  string s;
  cin >> n >> s;
  fill(last, last + 30, -1);
  ps[0] = 1;
  last[s[0] - 'a'] = 0;
  for (int i = 1; i < n; i++) {
    ps[i] = ps[i - 1];
    if (last[s[i] - 'a'] == -1) ps[i]++;
    last[s[i] - 'a'] = i;
  }
  long long ans = ps[n - 1];
  for (int len = 2; len <= n; len++) {
    fill(last, last + 30, -1);
    last[s[0] - 'a'] = 0;
    dp[0] = 0;
    for (int i = 1; i < n; i++) {
      dp[i] = (mod + ps[i - 1] -
               (last[s[i] - 'a'] == -1 ? 0 : ps[last[s[i] - 'a']])) %
              mod;
      last[s[i] - 'a'] = i;
    }
    ps[0] = 0;
    for (int i = 1; i < n; i++) ps[i] = (ps[i - 1] + dp[i]) % mod;
    long long x = ps[n - 1];
    ans += cmb(n - 1, len - 1) * x;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
