#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num_max = 0, max = -1, sum[26];
  memset(sum, 0, sizeof(sum));
  long long ans = 1, modulo = 1000000007;
  char str[100001];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> str[i];
    sum[str[i] - 'A']++;
    if (sum[str[i] - 'A'] > max) {
      max = sum[str[i] - 'A'];
      num_max = 1;
    } else if (sum[str[i] - 'A'] == max)
      num_max++;
  }
  if (num_max == 1) {
    ans = 1;
  } else {
    for (int i = 1; i <= n; i++) ans = (ans * num_max) % modulo;
  }
  cout << ans << '\n';
  return 0;
}
