#include <bits/stdc++.h>
using namespace std;
long long modVal = 1000000007;
int getDNALetterCode(char c) {
  if (c == 'A')
    return 0;
  else if (c == 'T')
    return 1;
  else if (c == 'C')
    return 2;
  else if (c == 'G')
    return 3;
  else
    return 4;
}
long long mod(long long &num, long long &pow, long long &mod) {
  num %= mod;
  long long currVal = 1, currPow;
  for (currPow = 0; currPow < pow; currPow++) {
    currVal = (currVal * num) % mod;
  }
  return currVal;
}
int main() {
  long long n, maxLetterOccur;
  string s;
  int letterOccurrences[4] = {0};
  cin >> n >> s;
  for (int i = 0; i < n; i++) {
    letterOccurrences[getDNALetterCode(s[i])]++;
  }
  maxLetterOccur = *max_element(letterOccurrences, letterOccurrences + 4);
  long long ctr = 0;
  for (int i = 0; i < 4; i++) {
    if (letterOccurrences[i] == maxLetterOccur) ctr++;
  }
  cout << mod(ctr, n, modVal) << endl;
  return 0;
}
