#include <bits/stdc++.h>
#define ll long long

using namespace std;

const int lb = 9, ub = 44;
int v[lb+ub+5][lb+ub+5];

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n; cin >> n;
  int i, j, z, e, pin, p2, p5;
  ll m, ans = 0;
  string s;
  for (i = 1; i <= n; i++) {
    cin >> s;
    m = e = pin = 0;
    for (char ch: s) {
      if (pin) e++;
      if (ch == '.') pin = 1;
      else m = m*10 + ch - '0';
    }
    p2 = -e;
    while (m % 2 == 0) {
      p2++;
      m /= 2;
    }
    p5 = -e;
    while (m % 5 == 0) {
      p5++;
      m /= 5;
    }
    for (int i2 = -lb; i2 <= ub; i2++)
      for (int i5 = -lb; i5 <= ub; i5++)
        if (i2+p2 >= 0 && i5+p5 >= 0) ans += 1LL*v[lb+i2][lb+i5];
    v[lb+p2][lb+p5]++;
  }
  cout << ans;
  return 0;
}
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main() {

    ll n,a; cin >> n;
    map<ll,ll> mp;
    set<ll> st;
    ll ans = 1;
    ll prev,val;
    bool f = false;

    rep(i,n){
        cin >> a;
        if(mp.count(a) == 0) mp[a] = 1;
        else mp[a] ++;
        st.insert(a);

        if(a == 0 && i != 0){
            cout << 0;
            return 0;
        }
        if(a == 0 && i == 0) f = true;
    }

    if(!f){
        cout << 0;
        return 0;
    }



    for(auto itr = st.begin(); itr != st.end(); ++itr) {
        if(*itr == 0) {
            prev = mp[*itr];
            val = *itr;
        }
        else{
            if(*itr - val != 1){
                cout << 0;
                return 0;
            }
            if(prev == 0){
                cout << 0;
                return 0;
            }
            rep(i,mp[*itr]){
                ans = (prev*ans)%998244353;
            }
            prev = mp[*itr];
            val = *itr;
        }
    }
    cout << ans;


    return 0;
}
