#include <bits/stdc++.h>
using namespace std;
int power(long long a, long long n, long long m) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) {
      ret = (ret * a) % m;
    }
    n = n >> 1;
    a = (a * a) % m;
  }
  return ret;
}
int main() {
  int n;
  cin >> n;
  string buf;
  cin >> buf;
  map<char, int> letters;
  for (int i = 0; i < n; ++i) {
    letters[buf[i]]++;
  }
  int max = 0, count = 0;
  for (auto it = letters.begin(); it != letters.end(); ++it) {
    if (max < it->second) {
      count = 1;
      max = it->second;
    } else if (max == it->second) {
      count++;
    }
  }
  cout << power(count, buf.size(), 1000000007) << endl;
}
