#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
int power(int a, int b) {
  long long k = 1;
  for (int i = 1; i <= b; i++) k = (k * a) % MOD;
  return k;
}
int was[100001];
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 'A'; i <= 'Z'; i++) was[i] = false;
  for (int i = 0; i < int(s.length()); i++) was[s[i]]++;
  int m = 0;
  for (int i = 'A'; i <= 'Z'; i++)
    if (was[i] > m) m = was[i];
  int k = 0;
  for (int i = 'A'; i <= 'Z'; i++)
    if (was[i] == m) k++;
  cout << power(k, n);
  return 0;
}
