#include <bits/stdc++.h>
using namespace std;
const long long MX = (5009), MOD = 1e9 + 7;
int comb[MX][MX], dp[MX][MX], last[500];
int n;
string str;
int main() {
  cin >> n >> str;
  str = "#" + str;
  for (int j = 0; j <= n; j++) {
    comb[j][0] = 1;
    for (int i = 1; i <= j; i++)
      comb[j][i] = (comb[j - 1][i] + comb[j - 1][i - 1]) % MOD;
  }
  for (int j = 0; j <= n; j++) dp[0][j] = 1;
  for (int L = 1; L <= n; L++) {
    memset(last, 0, sizeof(last));
    for (int pos = 1; pos <= n; pos++) {
      dp[L][pos] = dp[L - 1][pos - 1];
      if (last[str[pos]]) dp[L][pos] -= dp[L - 1][last[str[pos]]];
      dp[L][pos] += MOD;
      dp[L][pos] %= MOD;
      dp[L][pos] += dp[L][pos - 1];
      dp[L][pos] %= MOD;
      last[str[pos]] = pos;
    }
  }
  long long ans = 0;
  for (int L = 1; L <= n; L++) {
    ans += 1ll * dp[L][n] * comb[n - 1][L - 1];
    ans %= MOD;
  }
  cout << ans << endl;
}
