#include <bits/stdc++.h>
using namespace std;
char str[100200];
long long countA[5];
int main() {
  long long n;
  cin >> n;
  cin >> str;
  for (int i = 0; i < 5; i++) {
    countA[i] = 0;
  }
  for (long long i = 0; i < n; i++) {
    switch (str[i]) {
      case 'A':
        countA[0]++;
        break;
      case 'C':
        countA[1]++;
        break;
      case 'G':
        countA[2]++;
        break;
      case 'T':
        countA[3]++;
        break;
    }
  }
  long long maxCount, num = 0;
  maxCount = max(max(countA[0], countA[1]), max(countA[2], countA[3]));
  for (int i = 0; i < 4; i++) {
    if (countA[i] == maxCount) num++;
  }
  long long l = n, ans = num;
  for (int i = 1; i < n; i++) {
    ans = (long long)((ans) * (num)) % 1000000007;
  }
  cout << ans << "\n";
}
