#include <bits/stdc++.h>
using namespace std;
const long long N = 5e3 + 5, inf = 1e18, mod = 1e9 + 7;
long long c[N][N];
long long dp[N][26];
long long sum[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  for (int i = 0; i < N; i++) c[0][i] = 1, c[i][i] = 1;
  for (int i = 1; i < N; i++)
    for (int j = i + 1; j < N; j++) {
      c[i][j] = (c[i - 1][j - 1] + c[i][j - 1]) % mod;
      c[i][j] %= mod;
    }
  long long n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    for (int k = n; k >= 1; k--) {
      long long tmp = dp[k][s[i] - 'a'];
      if (k != 1) {
        dp[k][s[i] - 'a'] = sum[k - 1] - dp[k - 1][s[i] - 'a'];
        dp[k][s[i] - 'a'] += mod;
        dp[k][s[i] - 'a'] %= mod;
      } else if (dp[k][s[i] - 'a'] == 0)
        dp[k][s[i] - 'a'] = 1;
      sum[k] += dp[k][s[i] - 'a'] - tmp + mod;
      dp[k][s[i] - 'a'] += mod;
      dp[k][s[i] - 'a'] %= mod;
      sum[k] %= mod;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += (c[i - 1][n - 1] * sum[i]) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
