#include <bits/stdc++.h>
using namespace std;
int n;
string s;
long long result;
int num[26];
int main() {
  result = 1;
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    num[s[i] - 'A']++;
  }
  int mcount = 0;
  for (int i = 0; i < 26; i++) mcount = max(mcount, num[i]);
  int count = 0;
  for (int i = 0; i < 26; i++)
    if (num[i] == mcount) count++;
  for (int i = 0; i < s.size(); i++) {
    result = (result * count) % 1000000007;
  }
  cout << result << endl;
}
