#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long p) {
  if (p == 0) return 1;
  if (p == 1) return a;
  if ((p % 2) == 1)
    return (a * (power((a * a) % 1000000007, p / 2) % 1000000007)) % 1000000007;
  else
    return (power((a * a) % 1000000007, p / 2) + 1000000007) % 1000000007;
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int a[4];
  for (int i = 0; i < 4; i++) a[i] = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A') a[0]++;
    if (s[i] == 'C') a[1]++;
    if (s[i] == 'G') a[2]++;
    if (s[i] == 'T') a[3]++;
  }
  int mm = a[0];
  for (int i = 0; i < 4; i++)
    if (a[i] > mm) mm = a[i];
  long long c = 0;
  for (int i = 0; i < 4; i++)
    if (a[i] == mm) c++;
  long long k = n;
  cout << power(c, k) << "\n";
  return 0;
}
