#include <bits/stdc++.h>
using namespace std;
int main() {
  int lel;
  cin >> lel;
  string s;
  cin >> s;
  long long mod = 1000000007;
  long long A = 0, G = 0, T = 0, C = 0;
  for (long long(i) = (0); (i) < (lel); (i)++) {
    if (s[i] == 'A') A++;
    if (s[i] == 'C') C++;
    if (s[i] == 'T') T++;
    if (s[i] == 'G') G++;
  }
  long long ma = max(max(A, C), max(G, T));
  long long tam = 0;
  if (A == ma) tam++;
  if (G == ma) tam++;
  if (C == ma) tam++;
  if (T == ma) tam++;
  long long resp = 1LL;
  for (long long(i) = (0); (i) < (s.size()); (i)++) {
    resp = (resp * tam) % (mod);
  }
  cout << resp << endl;
  return 0;
}
