#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  string str;
  cin >> n >> str;
  int freq[0x100];
  memset(freq, 0, sizeof(freq));
  for (int i = 0; i < n; i++) freq[(int)str[i]]++;
  int maxFreq = max(max(freq['A'], freq['C']), max(freq['G'], freq['T']));
  int k = (freq['A'] == maxFreq) + (freq['C'] == maxFreq) +
          (freq['G'] == maxFreq) + (freq['T'] == maxFreq);
  long long ans = 1;
  for (int i = 0; i < n; i++) ans = (ans * k) % 1000000007;
  cout << ans << endl;
  return 0;
}
