#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int main() {
  read_file();
  int n;
  while (cin >> n) {
    string s;
    cin >> s;
    vector<int> cnt(26, 0);
    for (int i = 0; i < n; i++) cnt[s[i] - 'A']++;
    int mx = *max_element(((cnt).begin()), ((cnt).end()));
    int x = 0;
    for (int i = 0; i < 26; i++) x += cnt[i] == mx;
    int ans = 1;
    for (int i = 0; i < n; i++) ans = 1LL * ans * x % (1000000007);
    cout << ans << '\n';
  }
}
