while line = gets
a = line.split.map(&:to_i)
b = gets.split.map(&:to_i)

count1 = 0
count2 = 0

for i in (0..3)
  for j in (0..3)
    if a[i] == b[j]
      if i == j
        count1 += 1
      else
        count2 += 1
      end
    end
  end
end
puts count1.to_s+" "+count2.to_s
end
