#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7, Mo = 1e9 + 7;
int n, m, q;
int a[MAXN];
char ss[MAXN];
long long qm(long long s, long long t) {
  if (t == 0) return 1;
  if (t == 1) return s;
  long long rst = qm(s, t >> 1);
  rst = rst * rst % Mo;
  if (t & 1) rst = rst * s % Mo;
  return rst;
}
int main() {
  scanf("%d", &n);
  scanf("%s", ss);
  int len = strlen(ss);
  for (int i = 0; i < len; i++) {
    if (ss[i] == 'A') a[0]++;
    if (ss[i] == 'C') a[1]++;
    if (ss[i] == 'G') a[2]++;
    if (ss[i] == 'T') a[3]++;
  }
  sort(a, a + 4);
  int r = 3;
  while (r && a[r - 1] == a[3]) r--;
  cout << qm(3 - r + 1, n) << endl;
  return 0;
}
