#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
map<char, int> cnt;
string SS = "ACGT";
int conv(char c) {
  for (int i = 0; i < 4; i++)
    if (c == SS[i]) return i;
  return 0;
}
int main() {
  std::ios_base::sync_with_stdio(0);
  int n;
  string s;
  cin >> n;
  cin >> s;
  vector<int> rs(4, 0);
  for (int i = 0; i < s.size(); i++) rs[conv(s[i])]++;
  long long res = 1, cnt = 0;
  sort(rs.rbegin(), rs.rend());
  for (int i = 0; i < 4; i++)
    if (rs[0] == rs[i]) cnt++;
  for (long long i = 1; i <= n; i++) {
    res *= cnt;
    res %= 1000000000 + 7;
  }
  cout << res << endl;
  return 0;
}
