while a = gets do
  a = a.split.map(&:to_i)
  b = gets.split.map(&:to_i)
  h = 0
  c = 0
  4.times do |i|
    4.times do |j|
      c = c + 1 if a[i] == b[j] && i != j
    end
    h = h + 1 if a[i] == b[i]
  end
  puts "#{h} #{c}"
end