#include <bits/stdc++.h>
const int INF = 100000000;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
using namespace std;
int main() {
  map<char, int> cnt;
  string s;
  int n;
  cin >> n >> s;
  for (int i = 0; i < (s.size()); i++) cnt[s[i]]++;
  int maxi = max(max(cnt['A'], cnt['G']), max(cnt['C'], cnt['T']));
  int mul = 0;
  for (auto e : cnt) {
    if (maxi == e.second) mul++;
  }
  long long ans = 1;
  for (int i = 0; i < (n); i++) {
    ans *= mul;
    ans %= 1000000007LL;
  }
  cout << ans << endl;
  return 0;
}
