#include <bits/stdc++.h>
using namespace std;
long long const delta = 1000000007;
long long cnt[(long long)1e5 + 8];
long long poww(long long a, long long b) {
  if (b == 0) return 1;
  long long x = poww(a, b / 2);
  x %= delta;
  if (b % 2 == 1) return ((((x * x) % delta) * a) % delta);
  return ((x * x) % delta);
}
int main() {
  std::ios::sync_with_stdio(0);
  ;
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long mmax = 0;
  long long cntC = 0, cntG = 0, cntA = 0, cntT = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'C') cntC++;
    if (s[i] == 'G') cntG++;
    if (s[i] == 'A') cntA++;
    if (s[i] == 'T') cntT++;
    mmax = max(mmax, cntA);
    mmax = max(mmax, cntC);
    mmax = max(mmax, cntT);
    mmax = max(mmax, cntG);
  }
  cnt[cntA]++;
  cnt[cntC]++;
  cnt[cntG]++;
  cnt[cntT]++;
  cout << ((long long)poww(cnt[mmax], n)) % delta;
  return 0;
}
