#include <bits/stdc++.h>
using namespace std;
long long i, j, x, y, w, k, z, l, p, a[100002], n, m;
string s;
bool mark[500000];
long long ast(long long x, long long y) {
  p = 1;
  for (i = 1; i <= n; i++) {
    p = (p * k) % 1000000007;
  }
  return p;
}
int main() {
  cin >> n >> s;
  for (i = 0; i < s.size(); i++) {
    if (s[i] == 'A') a[1]++;
    if (s[i] == 'C') a[2]++;
    if (s[i] == 'G') a[3]++;
    if (s[i] == 'T') a[0]++;
  }
  sort(a, a + 4);
  k = 1;
  if (a[3] == a[2]) {
    k++;
    if (a[2] == a[1]) {
      k++;
      if (a[1] == a[0]) k++;
    }
  }
  cout << ast(k, n) << endl;
  return 0;
}
