import itertools

N = int(input())
ABs = [list(map(int,input().split())) for _ in range(N)]
hate = []

for com in itertools.combinations(list(range(N)),2):
    if ABs[com[0]][0]*ABs[com[1]][0] + ABs[com[0]][1]*ABs[com[1]][1] == 0:
        hate.append(list(com))

cnt = 0
for p in itertools.product([0,1],repeat = N):
    if sum(p)==0:
        continue
    for h in hate:
        if p[h[0]]==p[h[1]]==1:
            break
    else:
        cnt += 1
print(cnt)