#include <bits/stdc++.h>
using namespace std;
const long long N = 100100, MOD = 1e9 + 7;
long long pw[5][N];
long long n, ta, tc, tg, tt, res, jav;
string inp;
int main() {
  ios_base::sync_with_stdio(false);
  for (int i = 1; i <= 4; ++i) pw[i][0] = 1;
  for (int i = 1; i < N; ++i)
    for (int j = 1; j <= 4; ++j) {
      pw[j][i] = pw[j][i - 1] * j;
      pw[j][i] %= MOD;
    }
  cin >> n;
  cin >> inp;
  for (int i = 0; i < inp.size(); ++i) {
    if (inp[i] == 'A')
      ++ta;
    else if (inp[i] == 'C')
      ++tc;
    else if (inp[i] == 'G')
      ++tg;
    else
      ++tt;
  }
  res = ((((ta) > (tc) ? (ta) : (tc))) > (((tg) > (tt) ? (tg) : (tt)))
             ? (((ta) > (tc) ? (ta) : (tc)))
             : (((tg) > (tt) ? (tg) : (tt))));
  if (res == ta) ++jav;
  if (res == tc) ++jav;
  if (res == tg) ++jav;
  if (res == tt) ++jav;
  cout << pw[jav][n] << "\n";
  return 0;
}
