#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, max = 0, c = 0, ans = 1;
  map<char, long long int> m;
  m['A'] = 0;
  m['C'] = 0;
  m['G'] = 0;
  m['T'] = 0;
  cin >> n;
  string s;
  cin >> s;
  for (i = 0; i < n; i++) m[s[i]]++;
  if (max < m['A']) max = m['A'];
  if (max < m['C']) max = m['C'];
  if (max < m['G']) max = m['G'];
  if (max < m['T']) max = m['T'];
  if (max == m['A']) c++;
  if (max == m['C']) c++;
  if (max == m['G']) c++;
  if (max == m['T']) c++;
  for (i = 0; i < n; i++) ans = (ans * c) % 1000000007;
  cout << ans << endl;
  return 0;
}
