#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int root = 565042129;
const int root_1 = 950391366;
const int root_pw = 1 << 20;
int mpow(int x, int y, int m) {
  if (y == 0) return 1;
  int temp = mpow(x, y / 2, m);
  if (y & 1) {
    temp = (1LL * temp * temp) % m;
    return (1LL * temp * x) % m;
  }
  return (1LL * temp * temp) % m;
}
int inverse(int a, int mod) { return mpow(a, mod - 2, mod); }
void fft(vector<int> &a, bool invert) {
  int n = a.size();
  for (int i = 1, j = 0; i < n; i++) {
    int bit = n >> 1;
    for (; j & bit; bit >>= 1) j ^= bit;
    j ^= bit;
    if (i < j) swap(a[i], a[j]);
  }
  for (int len = 2; len <= n; len <<= 1) {
    int wlen = invert ? root_1 : root;
    for (int i = len; i < root_pw; i <<= 1)
      wlen = (int)(1LL * wlen * wlen % MOD);
    for (int i = 0; i < n; i += len) {
      int w = 1;
      for (int j = 0; j < len / 2; j++) {
        int u = a[i + j], v = (int)(1LL * a[i + j + len / 2] * w % MOD);
        a[i + j] = u + v < MOD ? u + v : u + v - MOD;
        a[i + j + len / 2] = u - v >= 0 ? u - v : u - v + MOD;
        w = (int)(1LL * w * wlen % MOD);
      }
    }
  }
  if (invert) {
    int n_1 = inverse(n, MOD);
    for (int &x : a) x = (int)(1LL * x * n_1 % MOD);
  }
}
vector<int> PolyMult(vector<int> &a, vector<int> &b) {
  vector<int> fa(a.begin(), a.end()), fb(b.begin(), b.end());
  int n = 1;
  while (n < a.size() + b.size()) n <<= 1;
  fa.resize(n);
  fb.resize(n);
  fft(fa, false);
  fft(fb, false);
  for (int i = 0; i < n; i++) fa[i] = (1LL * fa[i] * fb[i]) % MOD;
  fft(fa, true);
  int rn = a.size() + b.size() - 1;
  vector<int> result(rn);
  for (int i = 0; i < rn; i++) result[i] = fa[i];
  return result;
}
vector<int> PolyPow(vector<int> a, int b) {
  int t = 1;
  int n = a.size();
  int mulsz = n * b + 1;
  while (t < mulsz) {
    t <<= 2;
  }
  a.resize(t);
  fft(a, false);
  for (int i = 0; i < t; i++) {
    a[i] = mpow(a[i], b % (MOD - 1), MOD);
  }
  fft(a, true);
  while (a.size() > 0 && a[a.size() - 1] == 0) {
    a.pop_back();
  }
  return a;
}
vector<vector<int>> lmao;
vector<int> solve(int l, int r) {
  if (l == r) {
    return lmao[l];
  }
  int mid = (l + r) / 2;
  vector<int> v1 = solve(l, mid);
  vector<int> v2 = solve(mid + 1, r);
  return PolyMult(v1, v2);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> arr(3000000);
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    arr[x]++;
  }
  vector<int> cnt(n + 1);
  for (int i = 0; i < 3000000; i++) {
    cnt[arr[i]]++;
  }
  vector<vector<int>> sed;
  for (int i = 1; i <= n; i++) {
    if (cnt[i]) {
      vector<int> curr(i + 1, 1);
      if (cnt[i] > 1) curr = PolyPow(curr, cnt[i]);
      lmao.push_back(curr);
    }
  }
  vector<int> ans = solve(0, lmao.size() - 1);
  int an2 = ans[n / 2];
  int an1 = ans[(n + 1) / 2];
  cout << max(an1, an2);
  return 0;
}
