#include <bits/stdc++.h>
using namespace std;
map<char, long long int> mp;
long long int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  long long int mx = 0;
  for (auto c : s) {
    mp[c]++;
    mx = max(mp[c], mx);
  }
  long long int ans = 1;
  long long int cnt = 0;
  for (auto cur : mp) {
    if (cur.second == mx) cnt++;
  }
  while (n--) {
    ans = (ans * cnt) % mod;
  }
  cout << ans;
}
