#include <bits/stdc++.h>
using namespace std;
int get(char c) {
  switch (c) {
    case 'A':
      return 0;
    case 'C':
      return 1;
    case 'G':
      return 2;
    default:
      return 3;
  }
}
int n, A[4];
string s;
int main() {
  cin >> n >> s;
  for (int i = 0; i < n; i++) A[get(s[i])]++;
  int mx = *max_element(A, A + 4);
  long long cnt = 0;
  for (int i = 0; i < 4; i++) cnt += (mx == A[i]);
  long long ans = 1;
  for (int i = 0; i < n; i++) ans = (ans * cnt) % 1000000007;
  cout << ans << '\n';
}
