#include <bits/stdc++.h>
using namespace std;
int pow(int a, int b) {
  long long k = 1;
  for (int i = 0; i < b; ++i) k = k * a % 1000000007;
  return k;
}
int a[150];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  string s;
  cin >> n >> s;
  for (int i = 0; i < n; ++i) ++a[s[i]];
  int mx = 0;
  int mxa = 0;
  for (int i = 'A'; i < 'Z'; ++i) {
    if (a[i] == mx)
      ++mxa;
    else if (a[i] > mx) {
      mx = a[i];
      mxa = 1;
    }
  }
  cout << pow(mxa, n) << endl;
}
