#include <bits/stdc++.h>
using namespace std;
const int inf = INT_MAX / 2;
const long long Mod = (long long)(1e9 + 7);
int n;
long long ma[256];
string s;
long long solve() {
  long long m = 0;
  for (auto it : s) {
    ma[it] += 1;
    m = max(ma[it], m);
  }
  long long cnt =
      (ma['A'] == m) + (ma['G'] == m) + (ma['C'] == m) + (ma['T'] == m);
  long long ans = 1;
  for (int(i) = (1); (i) <= (n); ++(i)) ans = ans * cnt % Mod;
  return ans;
}
int main() {
  iostream::sync_with_stdio(false);
  cin >> n >> s;
  cout << solve();
  return 0;
}
