#include <bits/stdc++.h>
using namespace std;
int main() {
  int size;
  string dna;
  cin >> size >> dna;
  vector<int> mostCommon(4, 0);
  for (int i = 0; i < size; i++) {
    if (dna[i] == 'A') {
      mostCommon[0]++;
    } else if (dna[i] == 'C') {
      mostCommon[1]++;
    } else if (dna[i] == 'G') {
      mostCommon[2]++;
    } else if (dna[i] == 'T') {
      mostCommon[3]++;
    }
  }
  int maximum =
      max(mostCommon[0], max(mostCommon[1], max(mostCommon[2], mostCommon[3])));
  int counter = 0;
  for (int i = 0; i < 4; i++) {
    if (maximum == mostCommon[i]) {
      counter++;
    }
  }
  long long result = 1;
  for (int i = 0; i < size; i++) {
    result = ((result * counter) + 1000000007) % 1000000007;
  }
  cout << result << endl;
}
