#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1, M = 1e9 + 7;
int n;
char s[N];
int Pow(int a, int b) {
  if (!b) return 1;
  long long res = Pow(a, b >> 1);
  res = (res * res) % M;
  if (b & 1) res = (res * a) % M;
  return res;
}
int main() {
  scanf("%d%s", &n, s);
  int A = 0, C = 0, G = 0, T = 0;
  for (int i = 0; i < n; ++i)
    if (s[i] == 'A')
      ++A;
    else if (s[i] == 'C')
      ++C;
    else if (s[i] == 'G')
      ++G;
    else
      ++T;
  int mx = max(max(A, C), max(G, T)), base = 0;
  if (A == mx) ++base;
  if (C == mx) ++base;
  if (G == mx) ++base;
  if (T == mx) ++base;
  printf("%d\n", Pow(base, n));
  return 0;
}
