#include <bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
int n;
string s;
int freq[10];
int main() {
  ios_base::sync_with_stdio(false);
  cout.precision(30);
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'A') ++freq[0];
    if (s[i] == 'C') ++freq[1];
    if (s[i] == 'G') ++freq[2];
    if (s[i] == 'T') ++freq[3];
  }
  int hi = 0;
  for (int i = 0; i < 4; ++i)
    if (hi < freq[i]) hi = freq[i];
  int tie = 0;
  for (int i = 0; i < 4; ++i)
    if (freq[i] == hi) ++tie;
  long long res = 1;
  for (int i = 0; i < n; ++i) {
    res = (res * tie) % MOD;
  }
  cout << res << endl;
  return 0;
}
