#include <bits/stdc++.h>
using namespace std;
int n, pat[4];
char str[100010], code[4 + 1] = "ACGT";
int trans(char ch) {
  for (int i = 0; i < 4; i++)
    if (code[i] == ch) return i;
  return -1;
}
long long sol() {
  int val, cnt;
  val = cnt = 0;
  for (int i = 0; i < 4; i++)
    if (val < pat[i]) val = pat[i];
  for (int i = 0; i < 4; i++)
    if (val == pat[i]) cnt++;
  long long ans, tmp;
  for (ans = 1, tmp = cnt; n; n >>= 1) {
    if (n & 1) {
      ans *= tmp;
      ans %= 1000000007LL;
    }
    tmp *= tmp;
    tmp %= 1000000007LL;
  }
  return ans;
}
int main() {
  while (scanf("%d%s", &n, str) != EOF) {
    memset(pat, 0, sizeof(pat));
    for (int i = 0; i < n; i++) pat[trans(str[i])]++;
    printf("%I64d\n", sol());
  }
}
