#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int maxn = 100086;
const double PI = atan(1.0) * 4.0;
const double eps = 1e-9;
const long long mod = 1000000007;
const int maxe = 10086 * 2;
long long quick_pow(long long a, long long n) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return ret;
}
char s[maxn];
int n, num[5];
int main() {
  scanf("%d%s", &n, s);
  memset(num, 0, sizeof num);
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A')
      num[0]++;
    else if (s[i] == 'G')
      num[1]++;
    else if (s[i] == 'T')
      num[2]++;
    else
      num[3]++;
  }
  int maxx = -1;
  for (int i = 0; i < 4; i++) maxx = max(maxx, num[i]);
  int a = 0;
  for (int i = 0; i < 4; i++)
    if (maxx == num[i]) a++;
  cout << quick_pow(a, n) << endl;
}
