#include <bits/stdc++.h>
using namespace std;
const int INF(0x3f3f3f3f);
const double DINF(1e20);
const double eps(1e-12);
inline void Scan(int& n) {
  n = 0;
  char c;
  bool flag(false);
  while (!isdigit(c = getchar()))
    if (c == '-')
      flag = true;
    else if (flag)
      flag = false;
  while (isdigit(c)) n = (n << 3) + (n << 1) + c - '0', c = getchar();
  if (flag) n = -n;
}
inline void Scan(long long& n) {
  n = 0LL;
  char c;
  bool flag(false);
  while (!isdigit(c = getchar()))
    if (c == '-')
      flag = true;
    else if (flag)
      flag = false;
  while (isdigit(c)) n = (n << 3LL) + (n << 1LL) + c - '0', c = getchar();
  if (flag) n = -n;
}
const int maxn(100010);
const int mod(1000000007);
int n, cnt[5];
char s[maxn];
map<char, int> p;
int main() {
  p['A'] = 1, p['C'] = 2, p['G'] = 3, p['T'] = 4;
  Scan(n);
  scanf("%s", s + 1);
  for (int(i) = (1); (i) <= (n); ++i) ++cnt[p[s[i]]];
  sort(cnt + 1, cnt + 5);
  long long q;
  if (cnt[1] == cnt[4])
    q = 4;
  else if (cnt[2] == cnt[4])
    q = 3;
  else if (cnt[3] == cnt[4])
    q = 2;
  else
    q = 1;
  long long ans = 1LL;
  for (int(i) = (1); (i) <= (n); ++i) ans = ans * q % mod;
  printf("%I64d\n", ans);
  return 0;
}
