#include <bits/stdc++.h>
using namespace std;
int p[6007][26];
int sum[6007];
int i, j, n, m;
int s[6007];
inline void fix(int& a) {
  if (a < 0)
    a += 1000000007;
  else if (a >= 1000000007)
    a -= 1000000007;
}
inline void make() {
  int now = 0, ne;
  for (i = 1; i <= n; i++) {
    ne = now;
    now = 1 - now;
    for (j = n; j > 1; j--) {
      sum[j] -= p[j][s[i]];
      p[j][s[i]] = sum[j - 1] - p[j - 1][s[i]];
      fix(p[j][s[i]]);
      sum[j] += p[j][s[i]];
      fix(sum[j]);
    }
    if (p[1][s[i]] == 0) {
      p[1][s[i]] = 1;
      sum[1]++;
    }
  }
}
struct Reverse {
  static const long long int div = 1000000007;
  long long int extend_gcd(long long int a, long long int b, long long int& x,
                           long long int& y) {
    long long int ans, t;
    if (b == 0) {
      x = 1;
      y = 0;
      return a;
    }
    ans = extend_gcd(b, a % b, x, y);
    t = x;
    x = y;
    y = t - (a / b) * y;
    return ans;
  }
  long long int reverse(long long int a) {
    static long long int x, y, ans;
    ans = extend_gcd(a, div, x, y);
    if (x < 0) return (x % div + div);
    return x;
  }
} r2;
struct Cn {
  static const long long int div = 1000000007;
  long long int p[6007 * 2];
  long long int revp[6007 * 2];
  long long int ans[6007 * 2];
  int n;
  void init(int nn, Reverse* r) {
    n = nn;
    int i;
    p[0] = revp[0] = 1;
    for (i = 1; i <= n; i++) {
      p[i] = (p[i - 1] * i) % div;
      revp[i] = r->reverse(p[i]);
    }
  }
  long long int Cij(int i, int j) {
    if (i > j) return 0;
    long long int ans = p[j];
    ans *= revp[i];
    ans %= div;
    ans *= revp[j - i];
    ans %= div;
    return ans;
  }
} cn;
int main() {
  scanf("%d", &n);
  char a;
  for (i = 1; i <= n; i++) {
    scanf(" %c", &a);
    s[i] = a - 'a';
  }
  cn.init(n + n, &r2);
  make();
  long long int ans = 0, now;
  for (i = 1; i <= n; i++) {
    now = sum[i];
    now = now * cn.Cij(i - 1, n - 1) % 1000000007;
    ans += now;
    ans %= 1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
