#include <bits/stdc++.h>
using namespace std;
const int Maxn = 4;
long long M = 1e9 + 7;
int n, num[Maxn];
string str;
long long ans = 1;
int main() {
  cin >> n >> str;
  str.size();
  for (char ch : str) {
    if (ch == 'A') num[0]++;
    if (ch == 'C') num[1]++;
    if (ch == 'G') num[2]++;
    if (ch == 'T') num[3]++;
  }
  int cnt = 0, Max = 0;
  for (int i = (int)(0); i < (int)(4); ++i) {
    if (num[i] > Max) Max = num[i], cnt = 0;
    if (num[i] == Max) ++cnt;
  }
  for (int i = (int)(0); i < (int)(n); ++i) ans = (ans * cnt) % M;
  cout << ans << endl;
  return 0;
}
