#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  long long r;
  r = powmod(a, b / 2);
  r *= r;
  r %= mod;
  if (b & 1) {
    r *= a;
    r %= mod;
  }
  return r;
}
int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  map<char, int> count;
  count['A'] = 0;
  count['C'] = 0;
  count['G'] = 0;
  count['T'] = 0;
  for (int i = 0; i < S.size(); ++i) {
    ++count[S[i]];
  }
  int max = 0;
  for (auto i : count) {
    if (i.second > max) {
      max = i.second;
    }
  }
  int maxCount = 0;
  for (auto i : count) {
    if (i.second == max) {
      ++maxCount;
    }
  }
  cout << powmod(maxCount, N) << "\n";
  return 0;
}
