#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1, mod = 1e9 + 7, A = 26;
int n;
char s[maxn];
int cnt[A];
long long power(long long base, long long p) {
  long long ret = 1;
  while (p) {
    if (p & 1) ret = ret * base % mod;
    base = base * base % mod;
    p >>= 1;
  }
  return ret;
}
int main() {
  scanf("%d %s", &n, s);
  for (int i = 0; i < n; ++i) ++cnt[s[i] - 'A'];
  int maxi = 0, number = 0;
  for (int i = 0; i < A; ++i) {
    if (maxi < cnt[i]) {
      maxi = cnt[i];
      number = 0;
    }
    if (maxi == cnt[i]) ++number;
  }
  printf("%lld\n", power(number, n));
}
