#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n;
  cin >> n;
  cin >> s;
  vector<int> v(4);
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'A') ++v[0];
    if (s[i] == 'C') ++v[1];
    if (s[i] == 'G') ++v[2];
    if (s[i] == 'T') ++v[3];
  }
  sort(v.begin(), v.end());
  int MAX = v.back();
  int kol = 0;
  for (int i = 0; i < 4; ++i) {
    if (v[i] == MAX) {
      ++kol;
    }
  }
  int INF = 1000000007;
  vector<int> ans(n + 1);
  ans[0] = 1;
  for (int i = 1; i <= n; ++i) {
    ans[i] = (1ll * ans[i - 1] * kol) % INF;
  }
  cout << ans[n] << endl;
  return 0;
}
