#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;
int a, b, c, d, n, m, k;
char str[5002];
int f[2][5003], fir[5003][26];
int ce[5003][5003];
int cc[5003];
inline void add(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
int main() {
  scanf("%d", &n);
  scanf("%s", str);
  memset(fir, 63, sizeof(fir));
  for (int _n((n)-1), i(0); i <= _n; i++) {
    for (int _n(n - 1), j(i); j <= _n; j++) {
      if (fir[i][str[j] - 'a'] > 1000000000) {
        fir[i][str[j] - 'a'] = j;
      }
    }
  }
  int now = 0, nx = 1;
  for (int _n((26) - 1), i(0); i <= _n; i++) {
    if (fir[0][i] < 1000000000) {
      f[nx][fir[0][i]] = 1;
    }
  }
  for (int _n((n)), j(1); j <= _n; j++) {
    swap(now, nx);
    memset((f[nx]), 0, sizeof(f[nx]));
    for (int _n((n)-1), i(0); i <= _n; i++) {
      if (!f[now][i]) continue;
      add(cc[j], f[now][i]);
      int cd = f[now][i];
      for (int _n((26) - 1), z(0); z <= _n; z++) {
        if (z == str[i] - 'a') continue;
        if (fir[i][z] < 1000000000) {
          add(f[nx][fir[i][z]], cd);
        }
      }
    }
  }
  for (int _n((5001) - 1), i(0); i <= _n; i++) {
    ce[i][0] = ce[i][i] = 1;
    for (int _n((i - 1)), j(1); j <= _n; j++) {
      ce[i][j] = ce[i - 1][j - 1] + ce[i - 1][j];
      if (ce[i][j] >= 1000000007) ce[i][j] -= 1000000007;
    }
  }
  int ans = 0;
  for (int _n((n)), i(1); i <= _n; i++) {
    ans = (ans + (long long)ce[n - 1][i - 1] * cc[i]) % 1000000007;
  }
  printf("%d\n", ans);
}
