#include <bits/stdc++.h>
using namespace std;
int h2[5];
int main() {
  int n;
  char h[100005];
  scanf("%d\n", &n);
  scanf("%s", h);
  int a = 0, c = 0, g = 0, t = 0;
  for (int i = 0; i < n; i++) {
    if (h[i] == 'A') a++;
    if (h[i] == 'C') c++;
    if (h[i] == 'G') g++;
    if (h[i] == 'T') t++;
  }
  h2[0] = -a;
  h2[1] = -c;
  h2[2] = -g;
  h2[3] = -t;
  sort(h2, h2 + 4);
  long long m = 1000000007;
  long long ans1 = 1, ans2 = 1, ans3 = 1, ans4 = 1;
  for (int i = 0; i < n; i++) {
    ans2 *= 2;
    ans2 %= m;
  }
  for (int i = 0; i < n; i++) {
    ans3 *= 3;
    ans3 %= m;
  }
  for (int i = 0; i < n; i++) {
    ans4 *= 4;
    ans4 %= m;
  }
  if (h2[0] == h2[1] && h2[1] == h2[2] && h2[2] == h2[3])
    printf("%lld", ans4);
  else if (h2[0] == h2[1] && h2[1] == h2[2])
    printf("%lld", ans3);
  else if (h2[0] == h2[1])
    printf("%lld", ans2);
  else
    printf("%lld", ans1);
}
