#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128777216")
using namespace std;
const long long LINF = 1000000000000000000LL;
const int INF = 1000000000;
const long double eps = 1e-9;
const long double PI = 3.1415926535897932384626433832795l;
void prepare(string s) {
  if (s.length() != 0) {
    freopen((s + ".in").c_str(), "r", stdin);
    freopen((s + ".out").c_str(), "w", stdout);
  }
}
const int NMAX = 1000100;
const int MOD = INF + 7;
char s[NMAX];
int n;
int c[4];
char sym[] = {'A', 'C', 'G', 'T'};
int get(char c) {
  for (int i = 0; i < (int)(4); i++)
    if (sym[i] == c) return i;
  assert(false);
  return -1;
}
void read() {
  scanf("%d\n", &n);
  scanf("%s", s);
}
int bpow(int a, int n) {
  int r = 1;
  for (; n > 0; n >>= 1) {
    if (n & 1) r = ((long long)r * (long long)a) % MOD;
    a = ((long long)a * (long long)a) % MOD;
  }
  return r;
}
void solve() {
  memset(c, 0, sizeof(c));
  for (int i = 0; i < (int)(n); i++) c[get(s[i])]++;
  int mx = *max_element(c, c + 4);
  int cnt = 0;
  for (int i = 0; i < (int)(4); i++)
    if (c[i] == mx) cnt++;
  printf("%d\n", bpow(cnt, n));
}
int main() {
  prepare("");
  read();
  solve();
  return 0;
}
