#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long w = 0, f = 1;
  char c = ' ';
  while (c < '0' || c > '9') c = getchar(), f = c == '-' ? -1 : f;
  while (c >= '0' && c <= '9') w = w * 10 + c - 48, c = getchar();
  return w * f;
}
long long read4() {
  char c = getchar();
  while (c != 'A' && c != 'C' && c != 'G' && c != 'T') c = getchar();
  if (c == 'A') return 1;
  if (c == 'C') return 2;
  if (c == 'G') return 3;
  return 4;
}
const long long mod = 1e9 + 7;
long long pown(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod, y >>= 1;
  }
  return res;
}
long long n, a[100005], b[5];
signed main() {
  n = read();
  for (long long i = 1; i <= n; i++) a[i] = read4(), b[a[i]]++;
  sort(b + 1, b + 4 + 1, [&](long long x, long long y) { return x > y; });
  if (b[1] != b[2]) return puts("1"), 0;
  if (b[2] != b[3]) return printf("%lld\n", pown(2, n)), 0;
  if (b[3] != b[4]) return printf("%lld\n", pown(3, n)), 0;
  printf("%lld\n", pown(4, n));
  return 0;
}
