#include <bits/stdc++.h>
using namespace std;
vector<long long> v;
int mod = 1000000007;
void inint() {
  v.push_back(1);
  long long now = 1;
  for (int i = 1; i < 100001; i++) {
    now *= i;
    now %= mod;
    v.push_back(now);
  }
}
long long power(long long v, long long t = mod - 2) {
  if (t == 0) return 1;
  long long ret = power(v, t / 2);
  ret *= ret;
  ret %= mod;
  if (t % 2) ret *= v;
  ret %= mod;
  return ret;
}
char a[100010];
long long ans = 1;
int main() {
  int n;
  int ma = 0;
  int tem = 0;
  int tim = 0;
  cin >> n;
  string H;
  cin >> H;
  inint();
  for (int i = 0; i < n; i++) a[i] = H[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    tem++;
    if (i == n - 1 || a[i] != a[i + 1]) {
      if (tem > ma) {
        ma = tem;
        tim = 1;
      } else if (tem == ma)
        tim++;
      tem = 0;
    }
  }
  cout << power(tim, n) << endl;
  return 0;
}
