#include <bits/stdc++.h>
using namespace std;
const int N = 1000000007;
int main() {
  int i;
  int a = 0, g = 0, c = 0, t = 0;
  int n;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    char ch;
    scanf(" %c", &ch);
    if (ch == 'A') a++;
    if (ch == 'G') g++;
    if (ch == 'C') c++;
    if (ch == 'T') t++;
  }
  int mz = max(max(a, g), max(c, t));
  int cc = 0;
  if (a == mz) cc++;
  if (g == mz) cc++;
  if (c == mz) cc++;
  if (t == mz) cc++;
  long long ans = 1;
  for (i = 1; i <= n; i++) {
    ans *= cc;
    ans %= N;
  }
  int ansx = ans;
  printf("%d\n", ansx);
  return 0;
}
