#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
ALDS1_4-B

Search II
=end
class Srch
  def binindex(c, s)
    i=0
    j=s.length-1
    if c < s[i] or c > s[j] then
      return(false)
    end
    while j>i do
      k=(i+j)/2

      if c < s[k]  then
        j=k-1
      elsif s[k] < c  then
        i=k+1
      else
        return true
      end
    end
    false
  end
end

class Main
  def initialize()
    #fh = open("/home/muz/Downloads/ALDS1_4_B_in1.txt")
    fh = STDIN

    n = fh.gets.chomp.to_i
    s = fh.gets.chomp.split.map{|x| x.to_i}
    q = fh.gets.chomp.to_i
    t = fh.gets.chomp.split.map{|x| x.to_i}

    abort("number of s not equal to n") if n != s.length
    abort("number of t not equal to q") if q != t.length
    sr = Srch.new()
    ans = 0
    t.each {|x|
      if sr.binindex(x, s) then
        ans += 1
      end
    }
    puts ans
  end

end

if $0==__FILE__ then
  Main.new()
end