#include <bits/stdc++.h>
using namespace std;
int used[101] = {0};
int main() {
  int n;
  string a;
  cin >> n;
  cin >> a;
  int maxone = 0;
  bool flag = false;
  for (int i = 0; i < n; i++) {
    used[a[i] - 'A']++;
    if (used[a[i] - 'A'] > maxone) {
      maxone = used[a[i] - 'A'];
    }
  }
  int answer = 0;
  if (used['A' - 'A'] == maxone) {
    answer++;
  }
  if (used['C' - 'A'] == maxone) {
    answer++;
  }
  if (used['G' - 'A'] == maxone) {
    answer++;
  }
  if (used['T' - 'A'] == maxone) {
    answer++;
  }
  long long int ans = 1;
  for (int i = 1; i <= n; i++) {
    ans = (ans * answer) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
