#include <bits/stdc++.h>
using namespace std;
int n;
int cnt[5];
char s[100100];
int ksm(int m, int n) {
  int ans = 1;
  while (n) {
    if (n & 1) ans = ((long long)ans * (long long)m) % 1000000007;
    n = n >> 1;
    m = ((long long)m * (long long)m) % 1000000007;
  }
  return ans;
}
int main() {
  scanf("%d\n", &n);
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    if (s[i] == 'A')
      cnt[1]++;
    else if (s[i] == 'C')
      cnt[2]++;
    else if (s[i] == 'G')
      cnt[3]++;
    else if (s[i] == 'T')
      cnt[4]++;
  }
  int x = 0, m = max(max(cnt[1], cnt[2]), max(cnt[3], cnt[4]));
  for (int i = 1; i <= 4; i++)
    if (cnt[i] == m) x++;
  printf("%d\n", ksm(x, n));
}
