#include <bits/stdc++.h>
using namespace std;
const int maxn = 1001000;
const int mod = 1000000007;
int A[10];
char S[maxn];
long long Pow(long long x, long long y) {
  long long Ans = 1;
  while (y) {
    if (y & 1) Ans = Ans * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return Ans;
}
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", S + 1);
  for (int i = 1; i <= n; i++)
    if (S[i] == 'A')
      A[1]++;
    else if (S[i] == 'G')
      A[2]++;
    else if (S[i] == 'C')
      A[3]++;
    else if (S[i] == 'T')
      A[4]++;
  int MAX = *max_element(A + 1, A + 5);
  int Ans = 0;
  for (int i = 1; i <= 4; i++)
    if (A[i] == MAX) Ans++;
  cout << Pow(Ans, n) % mod << endl;
  return 0;
}
