#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 1;
const long long MOD = 1e9 + 7;
const double PI = 3.141592653589793;
long long gcd(long long a, long long b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  long long fact[1000000], inv[1000000], fact_inv[1000000];
  fact[1] = inv[1] = fact_inv[1] = 1;
  fact[0] = inv[0] = fact_inv[0] = 1;
  for (int i = 2; i < 1000000; i++) {
    fact[i] = fact[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    fact_inv[i] = fact_inv[i - 1] * inv[i] % MOD;
  }
  long long n, k = 0;
  cin >> n;
  map<pair<long long, long long>, int> mp;
  long long d[200001];
  d[0] = 1;
  for (int i = 0; i < (int)(200000); i++) {
    d[i + 1] = d[i] * 2;
  }
  long long ans = d[n] - 1;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    long long c = abs(a), e = abs(b);
    if (e > c) swap(c, e);
    long long u = gcd(c, e);
    a = a / u;
    b = b / u;
    if (mp.count(pair<long long, long long>(b, -a)) ||
        mp.count(pair<long long, long long>(-b, a)))
      k++;
    else
      mp[pair<long long, long long>(a, b)] = 1;
    ;
  }
  cout << k << endl;
  long long com[200000];
  for (int i = 0; i <= k; i++) {
    com[i] = ((fact[k] * fact_inv[i] % MOD) * fact_inv[k - i]) % MOD;
  }
  for (int i = 1; i <= k; i++) {
    long long res = (com[i] * d[n - 2 * i]) % MOD;
    if (i % 2)
      ans -= res;
    else
      ans += res;
    ans = (ans + MOD) % MOD;
  }
  cout << ans << endl;
}
