#include <bits/stdc++.h>
using namespace std;
const long long N = 5e3 + 5;
const long long M = 27;
const long long mod = 1e9 + 7;
long long n;
string s;
int dp[N][N];
int choose[N][N];
long long last[M], ps[N];
void pre() {
  for (long long i = 0; i <= n; i++) {
    choose[i][0] = choose[i][i] = 1;
    for (long long j = 1; j < i; j++) {
      choose[i][j] = (choose[i - 1][j - 1] + choose[i - 1][j]) % mod;
    }
  }
}
int main() {
  cin >> n;
  cin >> s;
  pre();
  for (long long i = 1; i <= n; i++) {
    long long c = s[i - 1] - 'a';
    dp[i][1] = 1;
    for (long long j = 2; j <= n; j++) {
      dp[i][j] = (ps[j - 1] - dp[last[c]][j - 1] + mod) % mod;
    }
    for (long long j = 1; j <= n; j++) {
      ps[j] = (ps[j] - dp[last[c]][j] + dp[i][j] + mod) % mod;
    }
    last[c] = i;
  }
  long long ans = 0;
  for (long long i = 0; i < 26; i++) {
    for (long long j = 1; j <= n; j++) {
      ans = (ans + 1LL * dp[last[i]][j] * choose[n - 1][j - 1] % mod) % mod;
    }
  }
  cout << ans << endl;
}
