#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 7;
const int Q = 1e9 + 7;
inline int pls(int x, int y) { return ((long long)x + y) % Q; }
inline int mns(int x, int y) { return pls(x, Q - y); }
inline int mul(int x, int y) { return 1LL * x * y % Q; }
int pwr(int x, int tms) {
  int res = 1;
  for (; tms > 0; tms >>= 1) {
    if (tms & 1) res = mul(res, x);
    x = mul(x, x);
  }
  return res;
}
int n;
char s[M];
int cnt[4];
int inv[M];
int fac[M], ifac[M];
int str[M][5];
inline int binom(int n, int m) {
  return mul(fac[n], mul(ifac[m], ifac[n - m]));
}
int chg(char c) {
  if (c == 'A') return 0;
  if (c == 'G') return 1;
  if (c == 'C') return 2;
  if (c == 'T') return 3;
}
int main() {
  int i, j;
  scanf("%d%s", &n, s + 1);
  for (i = 1; i <= n; i++) cnt[chg(s[i])]++;
  int mx = 0, num = 0;
  for (i = 0; i < 4; i++) {
    if (cnt[i] == mx)
      num++;
    else if (cnt[i] > mx)
      mx = cnt[i], num = 1;
  }
  printf("%d\n", pwr(num, n));
  return 0;
}
