#include <bits/stdc++.h>
using namespace std;
long long dp[5001][26];
int main() {
  long long n;
  cin >> n;
  string d;
  cin >> d;
  long long sum[n + 1];
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j < 26; j++) {
      dp[i][j] = 0;
    }
    sum[i] = 0;
  }
  for (long long i = 0; i < n; i++) {
    long long a = d[i] - 'a';
    sum[1] = sum[1] + (1000000007 - dp[1][a] + 1);
    sum[1] %= 1000000007;
    dp[1][a] = 1;
    for (long long f = 2; f <= n; f++) {
      sum[f] = sum[f] + (1000000007 - dp[f][a]);
      sum[f] %= 1000000007;
      dp[f][a] = sum[f - 1] % 1000000007;
      sum[f] += dp[f][a];
      sum[f] %= 1000000007;
    }
  }
  long long ans = sum[n] % 1000000007;
  cout << ans << endl;
}
