#include <bits/stdc++.h>
using namespace std;
int n, v[200], x, c;
string s;
long long int putere(int a, int b) {
  if (b == 1) return a;
  return (a * putere(a, b - 1)) % 1000000007;
}
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.size(); ++i) v[s[i]]++;
  x = max(v['A'], v['C']);
  x = max(x, v['G']);
  x = max(x, v['T']);
  if (x == v['A']) c++;
  if (x == v['C']) c++;
  if (x == v['G']) c++;
  if (x == v['T']) c++;
  cout << putere(c, n);
}
