#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int mod = 998244353;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
struct combination {
  vector<mint> fact, ifact;
  combination(int n) : fact(n + 1), ifact(n + 1) {
    assert(n < mod);
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n] * ifact[k] * ifact[n - k];
  }
} c(200005);
long long gcd(long long u, long long v) {
  if (u <= 0 || v <= 0) return 0;
  if (u == 1 || v == 1) return 1;
  long long d = 1, t;
  while ((u % 2) == 0 && (v % 2) == 0) {
    d *= 2;
    u /= 2;
    v /= 2;
  }
  if ((u % 2) != 0)
    t = -v;
  else
    t = u;
  while (t != 0) {
    while ((abs(t) % 2) == 0) t /= 2;
    if (t > 0)
      u = t;
    else
      v = -t;
    t = u - v;
  }
  return u * d;
}
int main() {
  int n;
  cin >> n;
  long long a[n], b[n];
  for (int i = 0; i < (n); ++i) {
    cin >> a[i] >> b[i];
  }
  std::map<pair<int, int>, int> dist;
  for (int i = 0; i < (n); ++i) {
    ll c = a[i];
    ll d = b[i];
    ll g = gcd(abs(a[i]), abs(b[i]));
    if (c == 0 && d == 0) {
    } else if (c == 0) {
      d /= abs(d);
    } else if (d == 0) {
      c /= abs(c);
    } else {
      c /= g;
      d /= g;
    }
    if (c < 0) {
      c = -c, d = -d;
    }
    dist[std::make_pair(c, d)]++;
  }
  mint ans = 1;
  int zero = 0;
  for (auto itr = dist.begin(); itr != dist.end(); ++itr) {
    ll c = itr->first.first, d = itr->first.second;
    int val = itr->second;
    if (val == 0) continue;
    if (d < 0) {
      c = -c;
      d = -d;
    }
    auto p = make_pair(d, (d == 0) ? 1 : -c);
    if (c == 0 && d == 0) {
      zero = val;
    } else if (c <= 0) {
      if (dist[p] == 0) {
        ans *= (1 << val);
      } else {
      }
    } else {
      if (dist[p] == 0) {
        ans *= (1 << val);
      } else {
        ans *= (1 << val) - 1 + (1 << dist[p]) - 1 + 1;
      }
    }
  }
  if (zero > 0) {
    ans += zero;
  }
  cout << (ans - 1) << endl;
  return 0;
}
