f1 = open('literature_invivo.txt')
f2 = open('positive_train.txt')

data = []
for line in f2:
    line = line.strip().split()
    data.append((line[0], line[1]))

count = 0
for line in f1:
    line = line.strip().split()
    if (line[0], line[1]) in data:
        count += 1
    #else:
    #   print "\t".join(line)
print count
