#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll md = 1e9 + 7;
namespace mod {
template <class T, int M>
class MInt;
template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp);
template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n);
template <class T, int M>
class MInt {
  T n_;

 public:
  MInt() : n_(0) {}
  MInt(T n) : n_((n % M + M) % M) {}
  MInt &operator+=(const MInt &rhs) {
    n_ += rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }
    return *this;
  }
  MInt &operator-=(const MInt &rhs) {
    n_ += M - rhs.n_;
    if (n_ >= M) {
      n_ -= M;
    }
    return *this;
  }
  MInt &operator*=(const MInt &rhs) {
    n_ = n_ * rhs.n_ % M;
    return *this;
  }
  MInt &operator/=(const MInt &rhs) { return (*this) *= Inv(rhs); }
  T Get() { return n_; }
};
template <class T, int M>
MInt<T, M> operator-(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res -= rhs;
}
template <class T, int M>
MInt<T, M> operator+(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res += rhs;
}
template <class T, int M>
MInt<T, M> operator*(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res *= rhs;
}
template <class T, int M>
MInt<T, M> operator/(const MInt<T, M> &lhs, const MInt<T, M> &rhs) {
  MInt<T, M> res(lhs);
  return res /= rhs;
}
template <class T, int M>
MInt<T, M> Pow(const MInt<T, M> &base, T exp) {
  if (exp == 0) {
    return 1;
  }
  auto a = Pow(base, exp / 2);
  a *= a;
  if (exp % 2 == 1) {
    a *= base;
  }
  return a;
}
template <class T, int M>
MInt<T, M> Inv(const MInt<T, M> &n) {
  return Pow(n, static_cast<T>(M - 2));
}
}  // namespace mod
using MInt = mod::MInt<long long, md>;
class BinCoef {
  vector<MInt> f;

 public:
  BinCoef(int n) : f(n + 1) {
    f[0] = f[1] = 1;
    for (int i = 2; i <= n; i++) {
      f[i] = MInt(i) * f[i - 1];
    }
  }
  MInt NCM(int n, int m) {
    if (n < m) {
      return 0;
    }
    return f[n] * mod::Inv(f[m] * f[n - m]);
  }
};
int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  vector<pair<ll, ll>> vab(n);
  for (int i = 0; i < n; ++i) {
    cin >> vab[i].first >> vab[i].second;
  }
  sort(vab.begin(), vab.end());
  MInt cnt(n);
  for (int i = 0; i < vab.size(); ++i) {
    ll a = vab[i].first, b = vab[i].second;
    auto eq1 = equal_range(vab.begin() + i, vab.end(), pair<ll, ll>(b, -a));
    if (eq1.first != vab.end() && eq1.first->first == b &&
        eq1.first->second == -a) {
      cnt -= distance(eq1.first, eq1.second);
    }
    auto eq2 = equal_range(vab.begin() + i, vab.end(), pair<ll, ll>(-b, a));
    if (eq2.first != vab.end() && eq2.first->first == -b &&
        eq2.first->second == a) {
      cnt -= distance(eq2.first, eq2.second);
    }
  }
  auto ans = mod::Pow(MInt(2), cnt.Get()) + MInt(1);
  cout << ans.Get() << '\n';
  return 0;
}
