import math
import itertools

N = int(input())
iwashi_list = [tuple(map(int, input().split())) for _ in range(N)]

def Cmb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# pattern = 0
# for r in range(math.ceil(N / 2)):
#     pattern += Cmb(N, r+1)

# bad_pattern = 0
# for A, B in itertools.combinations(iwashi_list, 2):
#     if A[0]*A[1] + B[0]*B[1] == 0:
#         print('Bad', A, B)
#         bad_pattern += 1

pattern = 0
for r in range(math.ceil(N)):
    # イワシを r 匹取り出す
    hoge = 0
    for iwashis in itertools.combinations(iwashi_list, r+1):
        # if r == 1:
        #     import ipdb; ipdb.set_trace()
        # 仲が悪いイワシのペアがないかチェックする
        hoge += 1
        for A, B in itertools.combinations(iwashis, 2):
            # 仲が悪いイワシなら break
            if A[0]*A[1] + B[0]*B[1] == 0:
                break
        # 仲が悪いイワシの組み合わせじゃないので，パターンに追加
        else:
            pattern += 1
    # print(hoge)

print(pattern)
