#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, a = 0, c = 0, g = 0, t = 0, p = 0, m;
  long long q = 1;
  string s;
  cin >> n >> s;
  for (i = 0; i < n; i++)
    if (s[i] == 'A')
      a++;
    else if (s[i] == 'C')
      c++;
    else if (s[i] == 'G')
      g++;
    else
      t++;
  m = max(max(max(a, c), g), t);
  if (a == m) p++;
  if (c == m) p++;
  if (g == m) p++;
  if (t == m) p++;
  for (i = 0; i < n; i++) q = (q * p) % 1000000007;
  cout << q;
  return 0;
}
