#include <bits/stdc++.h>
using namespace std;
long long pow2(long a, long b) {
  long long res = a;
  for (int i = 1; i < b; ++i) {
    res = (res * a) % 1000000007;
  }
  return res;
}
int main() {
  vector<int> v(30, 0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  for (int i = 0; i < s.length(); ++i) {
    v[s[i] - 'A']++;
  }
  sort(v.begin(), v.end());
  long col = 1;
  for (int i = v.size() - 2; i >= 0; --i) {
    if (v[i] == v[i + 1]) {
      ++col;
    } else {
      break;
    }
  }
  cout << pow2(col, s.length());
}
