#include <bits/stdc++.h>
using namespace std;
long long sq(long long k) { return k * k; }
long long knan(long long k, long long n) {
  if (n == 1)
    return k;
  else if (n == 0)
    return 1;
  else {
    if (n % 2 == 0)
      return sq(knan(k, n / 2)) % 1000000007;
    else
      return (k * knan(k, n - 1)) % 1000000007;
  }
}
int main() {
  string s;
  int p[4], n;
  for (int i = 0; i < 4; i++) p[i] = 0;
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == 'A') p[0]++;
    if (s[i] == 'T') p[1]++;
    if (s[i] == 'C') p[2]++;
    if (s[i] == 'G') p[3]++;
  }
  int max(0), brmax(0);
  for (int i = 0; i < 4; i++)
    if (p[i] > max) max = p[i];
  for (int i = 0; i < 4; i++)
    if (p[i] == max) brmax++;
  cout << knan(brmax, n) % 1000000007 << endl;
  return 0;
}
