require 'set'

def get_ints
  gets.split.map(&:to_i)
end

def get_int
  gets.chomp.to_i
end

class Hash
  def put_set(key, value)
    self[key] = Set.new if self[key].nil?
    self[key].add(value)
  end

  def put(key, value)
    self[key] = [] if self[key].nil?
    self[key].push(value)
  end
end

MOD = 1000000007

params = []

p 'start'

N = get_int

N.times do |num|
  a, b = get_ints
  params[num] = { taste: a, smell: b }
end


stock = []

params.each.with_index do |p, i|
  params[(i+1)...].each.with_index do |op, j|
    if p[:taste] * op[:taste] + p[:smell] * op[:smell] == 0
      stock.push([i, j])
    end
  end
end


result_num = 2 ** N - 1
minus = true

loop do
  break if stock.length == 0

  stock.each do |arr|
    if minus
      result_num -= 2 ** (N - arr.length)
    else
      result_num += 2 ** (N - arr.length)
    end
  end

  res = stock.to_a
  stock = Set.new
  res.each.with_index do |r, i|
    res[i+1..].each do |x|
      x = (r | x).sort
      stock.add(x)
    end
  end

  minus = !minus
end

print result_num % MOD
