#include <bits/stdc++.h>
using namespace std;
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
template <class S, class T>
ostream &operator<<(ostream &os, pair<S, T> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long inf = 1000000001;
const long long INF = (long long)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
vector<long long> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vector<long long> dx2 = {1, 1, 0, -1, -1, -1, 0, 1},
                  dy2 = {0, 1, 1, 1, 0, -1, -1, -1};
const long long MOD = 1000000007;
const long long MAXN = 555555;
vector<long long> fact(MAXN);
vector<long long> rfact(MAXN);
long long mod_pow(long long x, long long p, long long M = MOD) {
  if (p < 0) {
    x = mod_pow(x, M - 2, M);
    p = -p;
  }
  long long a = 1;
  while (p) {
    if (p % 2) a = a * x % M;
    x = x * x % M;
    p /= 2;
  }
  return a;
}
long long mod_inverse(long long a, long long M = MOD) {
  return mod_pow(a, M - 2, M);
}
void set_fact(long long n, long long M = MOD) {
  fact[0] = fact[1] = rfact[0] = rfact[1] = 1;
  for (long long i = 2; i <= n; i++) {
    fact[i] = i * fact[i - 1] % M;
  }
}
long long nCr(long long n, long long r, long long M = MOD) {
  if (r > n) return 0;
  assert(fact[2] == 2);
  long long ret = fact[n];
  if (rfact[r] == 0) {
    rfact[r] = mod_inverse(fact[r], M);
  }
  ret = (ret * rfact[r]) % M;
  if (rfact[n - r] == 0) {
    rfact[n - r] = mod_inverse(fact[n - r], M);
  }
  ret = (ret * rfact[n - r]) % M;
  return ret;
}
long long nHr(long long n, long long r) { return nCr(n + r - 1, r); }
long long gcd(long long a, long long b) {
  if (b > a) {
    swap(a, b);
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ;
  long long n;
  cin >> n;
  vector<pair<long long, long long> > a;
  set<long long> a_z, b_z;
  map<pair<long long, long long>, long long> mp;
  set<pair<long long, long long> > st;
  for (long long i = 0; i < (long long)(n); i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 and y == 0) continue;
    if (x == 0)
      a_z.insert(i);
    else if (y == 0)
      b_z.insert(i);
    else {
      long long g = gcd(abs(x), abs(y));
      x /= g;
      y /= g;
      if (x < 0) {
        x *= -1;
        y *= -1;
      }
      mp[pair<long long, long long>(x, y)]++;
      st.insert(pair<long long, long long>(x, y));
    }
  }
  long long ans = mod_pow(2, a_z.size()) + mod_pow(2, b_z.size()) - 1;
  cerr << "ans"
       << ": " << ans << endl;
  ;
  while (st.size()) {
    auto itr = st.begin();
    pair<long long, long long> x = *itr;
    pair<long long, long long> y = x;
    swap(y.first, y.second);
    y.second *= -1;
    if (y.first < 0) {
      y.first *= -1;
      y.second *= -1;
    }
    st.erase(itr);
    if (st.count(y) == 0) {
      ans *= mod_pow(2, mp[x]);
    } else {
      ans *= mod_pow(2, mp[x]) + mod_pow(2, mp[y]) - 1;
      st.erase(y);
    }
  }
  cout << ans - 1 << endl;
}
