#include <bits/stdc++.h>
const int inf = 1e9 + 7;
int n, i, j, k, dp[5111][5111], cur[26], nxt[5111][26], ans;
char s[5111];
int main() {
  scanf("%d", &n);
  scanf("%s", s + 1);
  for (i = n; i >= 0; i--) {
    if (i) cur[s[i] - 'a'] = i;
    for (j = 0; j < 26; j++) nxt[i][j] = cur[j];
  }
  dp[0][0] = 1;
  for (i = 0; i < n; i++)
    for (j = 0; j <= n; j++)
      if (dp[i][j]) {
        int w = dp[i][j];
        for (k = 0; k < 26; k++)
          if (nxt[j][k])
            dp[i + 1][nxt[j][k]] = (dp[i + 1][nxt[j][k]] + w) % inf;
      }
  for (i = 1; i <= n; i++) ans = (ans + dp[n][i]) % inf;
  printf("%d", ans);
}
