문제 : [SWEA D3] 1220. [S/W 문제해결 기본] 5일차 - Magnetic
for t in range(1, 11):
N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
count = 0
for i in range(N):
state = 0
for j in range(N):
if arr[j][i] == 1 and state == 0:
state = 1
elif arr[j][i] == 2 and state == 1:
state = 0
count += 1
print(f"#{t} {count}")