#include <bits/stdc++.h>
using namespace std;
vector<char> v;
int main() {
  v.push_back('A');
  v.push_back('C');
  v.push_back('T');
  v.push_back('G');
  int n;
  cin >> n;
  string cad;
  cin >> cad;
  int mapa[30];
  memset(mapa, 0, sizeof mapa);
  int maxi = 0;
  for (int i = 0; i < cad.size(); i++) {
    mapa[cad[i] - 'A']++;
    maxi = max(maxi, mapa[cad[i] - 'A']);
  }
  int dif = 0;
  bool iguales = true;
  for (int i = 0; i < v.size(); i++) {
    if (mapa[v[i] - 'A'] == maxi) {
      dif++;
    }
  }
  long long res = 1;
  long long mod = 1000000007LL;
  for (int i = 1; i < n + 1; i++) res = (1LL * res * dif) % mod;
  cout << res << endl;
  return 0;
}
