#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
int main() {
  ios::sync_with_stdio(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  long long int count[4];
  memset(count, 0, sizeof(count));
  for (int i = 0; i < ((long long int)s.size()); i++) {
    if (s[i] == 'A') {
      count[0]++;
    }
    if (s[i] == 'C') {
      count[1]++;
    }
    if (s[i] == 'G') {
      count[2]++;
    }
    if (s[i] == 'T') {
      count[3]++;
    }
  }
  sort(count, count + 4);
  long long int max = count[3];
  long long int low = 0;
  for (int i = 0; i < 4; i++) {
    if (count[i] == max) {
      low++;
    }
  }
  long long int ans = low;
  for (int i = 1; i < n; i++) {
    ans = ans * low;
    ans %= mod;
  }
  cout << ans << endl;
}
