#include <bits/stdc++.h>
using namespace std;
long long f[10005];
char s[100005];
int main() {
  long long maxx, n, i, ans = 1, tmp = 0;
  scanf("%I64d%s", &n, s);
  for (i = 0; i < n; i++) f[s[i]]++;
  maxx = max(max(f['A'], f['G']), max(f['T'], f['C']));
  tmp = 0;
  if (f['A'] == maxx) tmp++;
  if (f['C'] == maxx) tmp++;
  if (f['G'] == maxx) tmp++;
  if (f['T'] == maxx) tmp++;
  for (i = 0; i < n; i++) ans = (ans * tmp) % 1000000007;
  printf("%I64d\n", ans);
  return 0;
}
