#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> let(30, 0);
  long long n;
  cin >> n;
  string pat;
  cin >> pat;
  for (int i = 0; i < n; ++i) {
    ++let[pat[i] - 'A'];
  }
  long long maxi = -1, cnt = 0, rpta = 1;
  for (int i = 0; i < let.size(); ++i) maxi = max(let[i], maxi);
  for (int i = 0; i < let.size(); ++i)
    if (let[i] == maxi) ++cnt;
  for (int i = 0; i < n; ++i)
    rpta = (rpta % int(1e9 + 7) * cnt % int(1e9 + 7)) % int(1e9 + 7);
  while (rpta < 0) {
    rpta = (rpta + int(1e9 + 7)) % int(1e9 + 7);
  }
  cout << rpta << "\n";
}
