#include <bits/stdc++.h>
using namespace std;
template <class T>
string toString(T n) {
  ostringstream ost;
  ost << n;
  ost.flush();
  return ost.str();
}
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
const long long mod = 1e9 + 7;
map<char, int> mp;
int n;
string s;
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    mp[s[i]]++;
  }
  int m = max(max(mp['A'], mp['G']), max(mp['C'], mp['T']));
  long long tmp = 0;
  if (m == mp['A']) tmp++;
  if (m == mp['G']) tmp++;
  if (m == mp['C']) tmp++;
  if (m == mp['T']) tmp++;
  long long ans = 1;
  for (int i = 0; i < n; i++) ans = ans * tmp % mod;
  cout << ans % mod << endl;
  return 0;
}
