#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll gcd(ll a, ll b) {
  if (a < b) swap(a, b);
  if (a == 0 || b == 0) {
    return max(abs(a), abs(b));
  }
  ll r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return abs(b);
}
ll lcm(ll a, ll b) { return (a / gcd(a, b) * b); }
ll mpow(ll x, ll n) {
  ll ans = 1;
  while (n != 0) {
    if (n & 1) ans = ans * x % 998244353;
    x = x * x % 998244353;
    n = n >> 1;
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  vector<pair<ll, ll> > AB(N);
  ll ans = 1;
  for (ll i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      AB[i].first = 0;
      AB[i].second = 0;
    } else {
      AB[i].first = A[i] / gcd(A[i], B[i]);
      AB[i].second = B[i] / gcd(A[i], B[i]);
    }
    if (AB[i].first < 0) {
      AB[i].first *= -1;
      AB[i].second *= -1;
    } else if (AB[i].first == 0) {
      AB[i].second = abs(AB[i].second);
    }
  }
  map<pair<ll, ll>, ll> mp;
  for (ll i = 0; i < N; i++) {
    mp[AB[i]]++;
  }
  auto itr = mp.begin();
  ll zeronum = 0;
  while (itr != mp.end()) {
    if (itr->first == make_pair(0LL, 0LL)) {
      zeronum++;
    } else {
      if (itr->second != 0) {
        ll chA = itr->first.second;
        ll chB = itr->first.first * -1;
        if (chA < 0) {
          chA *= -1;
          chB *= -1;
        }
        auto itrch = mp.find(make_pair(chA, chB));
        if (itrch != mp.end()) {
          ll tmp = mpow(2, itr->second);
          ll tmpch = mpow(2, itrch->second);
          tmp = (tmp + tmpch - 1 + 998244353) % 998244353;
          ans = ans * tmp % 998244353;
          itrch->second = 0;
        } else {
          ans = ans * mpow(2, itr->second) % 998244353;
        }
        itr->second = 0;
      }
    }
    itr++;
  }
  ans = (ans + zeronum - 1 + 998244353) % 998244353;
  cout << ans;
  cout << "\n";
  return 0;
}
