#include <bits/stdc++.h>
using namespace std;
const long long M = 7 + 1e9;
const int MN = 9 + 5000;
const int LEN = 27;
long long dp[MN][LEN];
long long dp1[MN];
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  string a;
  cin >> a;
  a = 'y' + a;
  dp1[0] = 1;
  for (int i = 1; i <= n; i++) {
    int c = a[i] - 'a';
    for (int j = 1; j <= n; j++) {
      long long prev = dp[j][c];
      dp[j][c] = dp1[j - 1];
      dp1[j] = (M + dp1[j] + dp[j][c] - prev) % M;
    }
  }
  long long sm = 0;
  for (int i = 0; i < LEN; i++) sm = (sm + dp[n][i]) % M;
  cout << sm;
}
