#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100007;
const long long mod = 1000000007;
long long Pow(long long x, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return res;
}
char str[MAX_N];
int a[5], n;
int main() {
  scanf("%d%s", &n, str);
  for (int i = 0; str[i]; ++i) {
    if (str[i] == 'A')
      ++a[0];
    else if (str[i] == 'C')
      ++a[1];
    else if (str[i] == 'G')
      ++a[2];
    else
      ++a[3];
  }
  int up = 0;
  for (int i = 0; i < 4; ++i) up = max(up, a[i]);
  int cnt = 0;
  for (int i = 0; i < 4; ++i)
    if (a[i] == up) ++cnt;
  long long ans = Pow(cnt, n);
  printf("%I64d\n", ans);
  return 0;
}
