#include <bits/stdc++.h>
using namespace std;
ifstream input;
ofstream output;
long long mod = 1000000007;
int appear[4];
int main(int argc, char *argv[]) {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  input.sync_with_stdio(false);
  output.sync_with_stdio(false);
  input.open(
      "/users/jihan/Algorithmic Programming/CodeForces/B261/B261/B261.in.txt");
  output.open(
      "/users/jihan/Algorithmic Programming/CodeForces/B261/B261/B261.out.txt");
  int size;
  string n;
  cin >> size >> n;
  for (int i = 0; i < n.size(); i++) {
    if (n[i] == 'A') appear[0]++;
    if (n[i] == 'C') appear[1]++;
    if (n[i] == 'G') appear[2]++;
    if (n[i] == 'T') appear[3]++;
  }
  long long ans;
  ans = 1;
  long long j = 0;
  j = max(appear[0], appear[1]);
  if (appear[0] == appear[1]) ans++;
  if (appear[2] > j) {
    j = appear[2];
    ans = 1;
  } else if (appear[2] >= j)
    ans++;
  if (appear[3] > j) {
    j = appear[3];
    ans = 1;
  } else if (appear[3] >= j)
    ans++;
  j = ans;
  ans = 1;
  for (int i = 0; i < n.size(); i++) {
    ans *= j;
    ans %= mod;
  }
  cout << ans << "\n";
  return 0;
}
