#include <bits/stdc++.h>
using namespace std;
const long long MAX = 510000;
const long long MOD = 998244353;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
signed main() {
  long long n, t = 0;
  cin >> n;
  long long a, b;
  map<pair<long long, long long>, long long> mp;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      t++;
      continue;
    }
    if (a == 0) {
      mp[make_pair(0, 1)]++;
      continue;
    }
    if (b == 0) {
      mp[make_pair(1, 0)]++;
      continue;
    }
    long long p = a, q = b;
    a = abs(a);
    b = abs(b);
    if (a > b) swap(a, b);
    while (a != 0) {
      b %= a;
      swap(a, b);
    }
    if (p < 0) {
      p *= -1;
      q *= -1;
    }
    mp[make_pair(p / b, q / b)]++;
  }
  long long ans = 1;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    if (i->second == 0) continue;
    if ((i->first).first == 0 || (i->first).second == 0) {
      ans = (ans * ((modpow(2, mp[make_pair(0, 1)], MOD) +
                     modpow(2, mp[make_pair(1, 0)], MOD) - 1) %
                    MOD)) %
            MOD;
      mp[make_pair(0, 1)] = 0;
      mp[make_pair(1, 0)] = 0;
    }
    if ((i->first).second < 0) {
      ans =
          (ans *
           ((modpow(2, i->second, MOD) +
             modpow(2, mp[make_pair(-1 * (i->first).second, (i->first).first)],
                    MOD) -
             1) %
            MOD)) %
          MOD;
      mp[make_pair(-1 * (i->first).second, (i->first).first)] = 0;
    } else {
      ans =
          (ans *
           ((modpow(2, i->second, MOD) +
             modpow(2, mp[make_pair((i->first).second, -1 * (i->first).first)],
                    MOD) -
             1) %
            MOD)) %
          MOD;
      mp[make_pair((i->first).second, -1 * (i->first).first)] = 0;
    }
  }
  cout << ans - 1 + t << endl;
}
