#include <bits/stdc++.h>
using namespace std;
long long n, ans = 1, mod = 1000000007, arr[4];
string pal;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> pal;
  for (int i = 0; i < n; i++)
    if (pal[i] == 'A') {
      arr[0]++;
    } else if (pal[i] == 'C') {
      arr[1]++;
    } else if (pal[i] == 'G') {
      arr[2]++;
    } else
      arr[3]++;
  sort(arr, arr + 4);
  if (arr[3] > arr[2]) {
  } else if (arr[2] > arr[1]) {
    for (int i = 0; i < n; i++) ans *= 2, ans %= mod;
  } else if (arr[1] > arr[0]) {
    for (int i = 0; i < n; i++) ans *= 3, ans %= mod;
  } else
    for (int i = 0; i < n; i++) ans *= 4, ans %= mod;
  cout << ans;
}
