#include <bits/stdc++.h>
int MODULUS = 1000000007;
std::vector<int> As;
std::vector<int> Bs;
void AddSardines(std::vector<int> &cooler, int i) {
  int pos = 0;
  while (i > 0) {
    if (i % 2 == 1) cooler.push_back(pos);
    pos++;
    i >>= 1;
  }
}
bool NoSillySardines(std::vector<int> cooler) {
  int L = cooler.size();
  for (int i = 0; i < L; i++) {
    int I = cooler[i];
    for (int j = i + 1; j < L; j++) {
      int J = cooler[j];
      if (As[I] * As[J] + Bs[I] * Bs[J] == 0) {
        return false;
      }
    }
  }
  return true;
}
int main() {
  int N;
  std::cin >> N;
  for (int i = 0; i < N; i++) {
    long A, B;
    std::cin >> A >> B;
    As.push_back(A);
    Bs.push_back(B);
  }
  long res = 0;
  long MAX = 1L << N;
  for (int i = 1; i < MAX; i++) {
    std::vector<int> cooler;
    AddSardines(cooler, i);
    assert(cooler.size() > 0);
    if (NoSillySardines(cooler)) {
      res++;
    }
  }
  std::cout << res << "\n";
}
