#include <bits/stdc++.h>
using namespace std;
string s;
int count_i[26];
int max_i = 0;
const int MOD = 1000000007;
int main() {
  getline(cin, s);
  getline(cin, s);
  int n = s.length();
  for (int i = 0; i < n; ++i) {
    count_i[s[i] - 'A']++;
  }
  for (char i = 'A'; i <= 'Z'; ++i) max_i = max(max_i, count_i[i - 'A']);
  int k = 0;
  for (char i = 'A'; i <= 'Z'; ++i) {
    if (count_i[i - 'A'] == max_i) k++;
  }
  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    ans = ans * k;
    ans = ans % MOD;
  }
  cout << ans << endl;
}
