newton/solutions/python/268A.py

15 lines
278 B
Python
Raw Normal View History

2025-01-11 11:41:29 +00:00
n = int(input())
uniforms = []
for _ in range(n):
h, a = input().split(' ')
uniforms.append([h,a])
count = 0
for idx_i, i in enumerate(uniforms):
for idx_j, j in enumerate(uniforms):
if idx_i != idx_j and i[0] == j[1]:
count += 1
print(count)