#include <bits/stdc++.h>
using namespace std;
const int64_t kMod = 1000 * 1000 * 1000 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int m[256] = {0};
  for (char ch : S) {
    ++m[ch];
  }
  const char letters[] = "ACGT";
  int values[4];
  for (int i = 0; i < 4; ++i) {
    values[i] = m[letters[i]];
  }
  sort(values, values + 4);
  int max_count = 1;
  for (int i = 3; i > 0; --i) {
    if (values[i] != values[i - 1]) {
      break;
    }
    ++max_count;
  }
  int64_t result = 1;
  for (int i = 0; i < N; ++i) {
    result = (result * max_count) % kMod;
  }
  cout << result << '\n';
  return 0;
}
