#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[4] = {0};
  int n;
  int s = 0;
  string str;
  cin >> n;
  cin >> str;
  long long S = 1;
  for (int i = 0; i < n; i++) {
    if (str[i] == 'A')
      arr[0]++;
    else if (str[i] == 'G')
      arr[1]++;
    else if (str[i] == 'T')
      arr[2]++;
    else if (str[i] == 'C')
      arr[3]++;
  }
  int max = 0;
  for (int i = 0; i < 4; i++) {
    if (arr[i] > max) max = arr[i];
  }
  for (int i = 0; i < 4; i++) {
    if (arr[i] == max) s++;
  }
  for (int i = 0; i < n; i++) {
    S *= s;
    S %= 1000000007;
  }
  cout << S;
  return 0;
}
