#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int n;
string s;
int chti(char ch) {
  if (ch == 'A') {
    return 0;
  }
  if (ch == 'T') {
    return 1;
  }
  if (ch == 'G') {
    return 2;
  }
  if (ch == 'C') {
    return 3;
  }
  assert(false);
}
int numh[4];
long long mpow(int a, int b) {
  if (b == 0) {
    return 1;
  }
  if (b == 1) {
    return a;
  }
  long long ret = mpow(a, b / 2);
  ret = (ret * ret) % MOD;
  if (b & 1) {
    ret = (ret * a) % MOD;
  }
  return ret;
}
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; ++i) {
    numh[chti(s[i])]++;
  }
  int best = -1, numb = 0;
  for (int i = 0; i < 4; ++i) {
    if (best < numh[i]) {
      best = numh[i];
      numb = 0;
    }
    if (best == numh[i]) {
      ++numb;
    }
  }
  cout << mpow(numb, n) << endl;
  return 0;
}
