#include <bits/stdc++.h>
using namespace std;
long long md = 1000000007;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b % 2 == 0)
    return power((a * a) % md, b / 2) % md;
  else
    return (a * power((a * a) % md, b / 2)) % md;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  string s;
  cin >> s;
  set<char> s1;
  map<char, long long> mp;
  long long temp = 0;
  for (int i = 0; i < s.length(); i++) {
    s1.insert(s[i]);
    mp[s[i]]++;
    temp = max(temp, mp[s[i]]);
  }
  long long c = 0;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    if ((i->second) == temp) c++;
  }
  long long l = s1.size();
  long long p = power(c, n);
  cout << p % md << endl;
}
