#include <bits/stdc++.h>
using namespace std;
long long powmod(long long a, long long n, long long mod) {
  a %= mod;
  if (n == 0) return 1;
  if (n % 2 == 0) return powmod((a * a) % mod, n / 2, mod);
  return (a * powmod(a, n - 1, mod)) % mod;
}
long long Mod(long long a, long long p) { return (a % p + p) % p; }
long long p1 = 1000000403;
long long p2 = 900000287;
long long p3 = 998244353;
long long n;
vector<long long> a;
vector<long long> b;
vector<long long> A1, A2, A3;
vector<long long> B1, B2, B3;
signed main() {
  long long i;
  cin >> n;
  long long genten = 0;
  for (i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 && y == 0)
      genten++;
    else {
      a.push_back(x);
      b.push_back(y);
    }
  }
  n = a.size();
  for (i = 0; i < n; i++) {
    A1.push_back(Mod(a[i], p1));
    A2.push_back(Mod(a[i], p2));
    A3.push_back(Mod(a[i], p3));
    B1.push_back(Mod(b[i], p1));
    B2.push_back(Mod(b[i], p2));
    B3.push_back(Mod(b[i], p3));
  }
  long long group_x = 0;
  long long group_y = 0;
  map<tuple<long long, long long, long long>, vector<long long>> ps;
  for (i = 0; i < n; i++) {
    if (b[i] == 0) {
      group_x++;
    } else if (a[i] == 0) {
      group_y++;
    } else {
      long long h1 = A1[i] * powmod(B1[i], p1 - 2, p1) % p1;
      long long h2 = A2[i] * powmod(B2[i], p2 - 2, p2) % p2;
      long long h3 = A3[i] * powmod(B3[i], p3 - 2, p3) % p3;
      tuple<long long, long long, long long> _hash =
          tuple<long long, long long, long long>(h1, h2, h3);
      ps[_hash].push_back(i);
    }
  }
  long long mod = 1000000007;
  long long ans = 1;
  set<tuple<long long, long long, long long>> seen;
  for (map<tuple<long long, long long, long long>, vector<long long>>::iterator
           it = ps.begin();
       it != ps.end(); it++) {
    if (seen.find(it->first) != seen.end()) {
      continue;
    }
    vector<long long> group = it->second;
    long long id = group[0];
    long long h1 = (p1 - B1[id]) % p1 * powmod(A1[id], p1 - 2, p1) % p1;
    long long h2 = (p2 - B2[id]) % p2 * powmod(A2[id], p2 - 2, p2) % p2;
    long long h3 = (p3 - B3[id]) % p3 * powmod(A3[id], p3 - 2, p3) % p3;
    tuple<long long, long long, long long> hsh =
        tuple<long long, long long, long long>(h1, h2, h3);
    map<tuple<long long, long long, long long>, vector<long long>>::iterator
        it2 = ps.find(hsh);
    if (it2 != ps.end()) {
      vector<long long> &group2 = it2->second;
      long long res = powmod(2, group.size(), mod) +
                      powmod(2, group2.size(), mod) % mod + mod - 1;
      res %= mod;
      ans *= res;
      ans %= mod;
      tuple<long long, long long, long long> tup = it2->first;
      seen.insert(tup);
    } else {
      ans *= powmod(2, group.size(), mod);
      ans %= mod;
    }
  }
  ans = (ans + mod - 1) % mod;
  ans = (ans + genten) % mod;
  cout << ans << endl;
  return 0;
}
