#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 10;
const int mod = 1000000000 + 7;
char s[maxn];
long long b[maxn];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    scanf("%s", s);
    int f[26];
    memset(f, 0, sizeof(f));
    for (int i = 0; i < n; i++) {
      f[s[i] - 'A']++;
    }
    sort(f, f + 26);
    int k = 1;
    for (int i = 24; i; i--) {
      if (f[i] == f[25]) {
        k++;
      } else {
        break;
      }
    }
    b[0] = 1;
    for (int i = 1; i <= n; i++) {
      b[i] = (b[i - 1] * k) % mod;
    }
    printf("%I64d\n", b[n]);
  }
  return 0;
}
