#include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
ostream &operator<<(ostream &O, pair<T1, T2> &t) {
  return O << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream &operator<<(ostream &O, vector<T> &t) {
  for (int _ = 0; _ < (int)t.size(); ++_) O << t[_] << " ";
  return O;
}
void dout() { cout << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cout << H << " ";
  dout(T...);
}
inline long long Cnk(int _n, int _k) {
  long long _r = 1;
  int _t = max(_k, _n - _k);
  for (int _i = _t + 1; _i <= _n; ++_i) {
    _r *= _i;
    _r /= _i - _t;
  }
  return _r;
}
int main() {
  int n;
  scanf("%d", &n);
  char s[100500];
  scanf("%s", &s);
  map<char, int> b;
  for (int i = 0; i < n; ++i) {
    b[s[i]]++;
  }
  int mx = 0;
  for (auto it = b.begin(); it != b.end(); it++) mx = max(mx, it->second);
  int k = 0;
  for (auto it = b.begin(); it != b.end(); it++) k += (it->second == mx);
  long long r = 1;
  for (int i = 0; i < n; ++i) {
    r = (r * 1LL * k) % (1000000007);
  }
  cout << r;
  return 0;
}
int cpp4cf_main() {
  freopen("A.cpp", "r", stdin);
  char s[99];
  bool f;
  while (true) {
    cin >> s;
    if (cin.eof()) break;
    if (strstr(s, "/*")) {
      cin >> s;
      if (strstr(s, "Test")) {
        cin >> s;
        if (strstr(s, "on")) {
          cout << "Output: ";
          cpp4cf_main();
          cout << "\nAnswer: ";
          f = false;
          while (true) {
            cin >> s;
            if (strstr(s, "*/")) break;
            if (strstr(s, "//")) {
              if (f)
                cout << endl;
              else
                f = true;
            } else
              cout << s << " ";
          }
          cout << "\n\n";
        }
      }
    }
  }
  return 0;
}
