#include <bits/stdc++.h>
using namespace std;
int cnt['T' + 1];
string p = "AGTC";
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0, __l = s.size(); i < __l; ++i) cnt[s[i]]++;
  int maxi = 0;
  for (int i = 0, __l = p.size(); i < __l; ++i) maxi = max(maxi, cnt[p[i]]);
  int x = 0;
  for (int i = 0, __l = p.size(); i < __l; ++i) x += cnt[p[i]] == maxi;
  long long ans = 1;
  for (int i = 0, __l = n; i < __l; ++i) (ans *= x) %= 1000000007;
  cout << ans << endl;
  return 0;
}
