import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)


    val n = sc.nextInt()

    val list = TreeSet<Int>()

    for (i in (0 until n)) {
       list.add(sc.nextInt())
    }

    val q = sc.nextInt()

    val t_list = ArrayList<Int>()
    for(i in 0 until q){
       t_list.add(sc.nextInt())
    }


    var ans = 0
    t_list.forEach{
        ans += if(list.contains(it)) 1 else 0
    }

    println(ans)

}

