#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60777216")
using namespace std;
const int mod = 1000000000 + 7;
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  int k1 = 0, k2 = 0, k3 = 0, k4 = 0;
  for (int i = (0); i < (n); i++) {
    if (s[i] == 'A') k1++;
    if (s[i] == 'C') k2++;
    if (s[i] == 'G') k3++;
    if (s[i] == 'T') k4++;
  }
  int mn = max(max(k1, k2), max(k3, k4));
  int num = (k1 == mn ? 1 : 0) + (k2 == mn ? 1 : 0) + (k3 == mn ? 1 : 0) +
            (k4 == mn ? 1 : 0);
  long long res = 1;
  for (int i = (0); i < (n); i++) res *= num, res %= mod;
  cout << res << endl;
  return 0;
}
