#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
constexpr long long mod = 1e9 + 7;
template <class T>
inline void chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
}
template <class T>
inline void chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
}
long long gcdx(long long a, long long b) { return b ? gcdx(b, a % b) : a; }
inline long long modu(long long a) { return (a % mod + mod) % mod; }
long long modpow(long long a, long long b) {
  long long res = 1;
  for (a = modu(a); b; a = modu(a * a), b >>= 1) {
    if (b & 1) res = modu(res * a);
  }
  return res;
}
long long sgn(long long A) { return (A > 0) - (A < 0); }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(12);
  long long N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> B(N);
  for (long long(i) = 0; (i) < (N); (i)++) cin >> A[i] >> B[i];
  map<P, P> ma;
  long long appendix = 0;
  for (long long(i) = 0; (i) < (N); (i)++) {
    if (sgn(A[i]) * sgn(B[i]) == 0) {
      if (A[i] == 0 && B[i] == 0) {
        appendix++;
      } else if (A[i] == 0) {
        B[i] = 1;
        ma[make_pair(A[i], B[i])].first++;
      } else {
        A[i] = 0;
        ma[make_pair(B[i], A[i])].second++;
      }
    } else if (sgn(A[i]) * sgn(B[i]) > 0) {
      long long gc = gcdx(abs(A[i]), abs(B[i]));
      A[i] /= gc;
      B[i] /= gc;
      ma[make_pair(abs(A[i]), abs(B[i]))].first++;
    } else {
      long long gc = gcdx(abs(A[i]), abs(B[i]));
      A[i] /= gc;
      B[i] /= gc;
      ma[make_pair(abs(B[i]), abs(A[i]))].second++;
    }
  }
  long long ans = 1;
  for (auto itr = ma.begin(); itr != ma.end(); itr++) {
    long long plus = 0;
    if (itr->second.first != 0) plus += modpow(2, itr->second.first);
    if (itr->second.second != 0) plus += modpow(2, itr->second.second);
    if (itr->second.first != 0 && itr->second.second != 0) plus--;
    ans *= plus;
  }
  cout << ans + appendix - 1 << "\n";
}
