#include <bits/stdc++.h>
using namespace std;
long long n, m = 1000000007;
string t;
long d[5];
int main() {
  cin >> n;
  cin >> t;
  for (int k = 0; k < n; ++k)
    if (t[k] == 'A')
      ++d[0];
    else if (t[k] == 'C')
      ++d[1];
    else if (t[k] == 'T')
      ++d[2];
    else
      ++d[3];
  long s = 0, maxx = 0;
  maxx = max(max(d[0], d[1]), max(d[2], d[3]));
  if (d[0] == maxx) ++s;
  if (d[1] == maxx) ++s;
  if (d[2] == maxx) ++s;
  if (d[3] == maxx) ++s;
  long long d = 1;
  for (int k = 1; k <= n; ++k) d = (d * 1ll * s) % m;
  cout << d;
  return 0;
}
