
info = open("DATA2.txt", "r")
put = open("OUT2.txt", "w")

c = info.readline()
something = []
new = []
add = []
plus = 0
total = 0
counter = 0
counted = 0
while c!="":
    word = c.strip("/n")
    c = info.readline()
    something.append(word)
    new = []
    add = []
    plus = 0
    total = 0
    counter = 0
    counted = counted + 1
    while counted == 10:
        first= something[0:5]
        second = something[5:10]
            
        for each in first:
            plus = int(each[0]) + int(each[2])
            add.append(plus)
            plus = 0
                
        for each in add:
            if counter == 5:
                break
            if each == int(second[counter]):
                total = total + 1
            else:
                total = total + 0

            counter = counter + 1
        print total
        put.write(str(total)+"\n")
        break
    while counted == 20:
        first= something[10:15]
        second = something[15:20]
            
        for each in first:
            plus = int(each[0]) + int(each[2])
            add.append(plus)
            plus = 0
                
        for each in add:
            if counter == 5:
                break
            if each == int(second[counter]):
                total = total + 1
            else:
                total = total + 0

            counter = counter + 1
        print total
        put.write(str(total)+"\n")
        break
    while counted == 30:
        first= something[20:25]
        second = something[25:30]
            
        for each in first:
            plus = int(each[0]) + int(each[2])
            add.append(plus)
            plus = 0
                
        for each in add:
            if counter == 5:
                break
            if each == int(second[counter]):
                total = total + 1
            else:
                total = total + 0

            counter = counter + 1
        print total
        put.write(str(total)+"\n")
        break
    while counted == 40:
        first= something[30:35]
        second = something[35:40]
            
        for each in first:
            plus = int(each[0]) + int(each[2])
            add.append(plus)
            plus = 0
                
        for each in add:
            if counter == 5:
                break
            if each == int(second[counter]):
                total = total + 1
            else:
                total = total + 0

            counter = counter + 1
        print total
        put.write(str(total)+"\n")
        break
    while counted == 50:
        first= something[40:45]
        second = something[45:50]
            
        for each in first:
            plus = int(each[0]) + int(each[2])
            add.append(plus)
            plus = 0
                
        for each in add:
            if counter == 5:
                break
            if each == int(second[counter]):
                total = total + 1
            else:
                total = total + 0

            counter = counter + 1
        print total
        put.write(str(total)+"\n")
        break
    while counted > 50:
        break

put.close()

