#include <bits/stdc++.h>
using namespace std;
const int MX = 5005;
const int MD = 1000000007;
void add(int& a, int b) {
  a += b;
  if (a >= MD) a -= MD;
}
char s[MX];
int olololo[MX][26];
int dp[MX][MX];
int main() {
  int n;
  ignore = scanf("%d", &n);
  ignore = scanf(" %s", s + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 26; j++) {
      olololo[i][j] = olololo[i - 1][j];
    }
    olololo[i][s[i] - 'a'] = i;
  }
  for (int c = 0; c < 26; c++) {
    dp[n][olololo[n][c]]++;
  }
  for (int i = n; i >= 2; i--) {
    for (int j = 1; j <= n; j++) {
      for (int c = 0; c < 26; c++) {
        add(dp[i - 1][olololo[j][c]], dp[i][j]);
      }
    }
  }
  int ans = 0;
  for (int j = 1; j <= n; j++) {
    add(ans, dp[1][j]);
  }
  printf("%d\n", ans);
}
