import itertools

n = int(input())
c = [[]]*n
ans = 0
for i in range(n):
  c[i] = list(map(int, input().split()))

for i in range(1, n):
  aa = list(itertools.combinations(c, i))
  for com in aa:
    for tmp in com:
      if [tmp[1] * -1, tmp[0]] in com:
        break
      if [tmp[1], -1 * tmp[0]] in com:
        break
    else:
      ans+=1

print(ans)
