#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100;
const long long mod = 1e9 + 7;
int a[5];
int n;
char ch;
long long f(int p, int n) {
  long long ans = 1;
  while (n--) {
    ans = (ans * p) % mod;
  }
  return ans;
}
int main() {
  cin >> n;
  getchar();
  for (int i = 0; i < n; i++) {
    cin >> ch;
    if (ch == 'A') a[0]++;
    if (ch == 'C') a[1]++;
    if (ch == 'G') a[2]++;
    if (ch == 'T') a[3]++;
  }
  sort(a, a + 4);
  int p = 1;
  for (int i = 0; i < 3; i++)
    if (a[i] == a[3]) p++;
  cout << f(p, n) << endl;
}
