#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long n;
char s[100002];
long long cnts[4];
long long jyo(long long a, long long x) {
  a %= MOD;
  if (x == 0) return 1;
  if (x == 1) return a;
  if (x % 2)
    return (jyo((a * a), x / 2) * a) % MOD;
  else
    return (jyo((a * a), x / 2)) % MOD;
}
signed main() {
  long long i, j;
  cin >> n;
  cin >> s;
  for (i = 0; i < n; i++) {
    cnts[0] += (s[i] == 'A');
    cnts[1] += (s[i] == 'C');
    cnts[2] += (s[i] == 'G');
    cnts[3] += (s[i] == 'T');
  }
  sort(cnts, cnts + 4, greater<long long>());
  for (i = 1; i < 4; i++)
    if (cnts[i] < cnts[0]) break;
  cout << jyo(i, n) % MOD << endl;
  return 0;
}
