#include <bits/stdc++.h>
using namespace std;
long long quickpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b % 2 == 1) {
      ans = (ans * a) % 1000000007;
    }
    b /= 2;
    a = (a * a) % 1000000007;
  }
  return ans;
}
int main() {
  long long n;
  int a = 0, t = 0, g = 0, c = 0;
  char tmp;
  int maxn = 0;
  long long num = 0;
  scanf("%lld", &n);
  getchar();
  for (int i = 0; i < n; i++) {
    +scanf("%c", &tmp);
    if (tmp == 'A')
      a++;
    else if (tmp == 'T')
      t++;
    else if (tmp == 'G')
      g++;
    else if (tmp == 'C')
      c++;
    maxn = max(maxn, max(max(a, t), max(g, c)));
  }
  if (a == maxn) num++;
  if (t == maxn) num++;
  if (g == maxn) num++;
  if (c == maxn) num++;
  long long ans = quickpow(num, n);
  printf("%lld\n", ans);
  return 0;
}
