using System;
using System.Linq;

namespace Linear_Search
{
    class Program
    {
        static void Main()
        {
            Console.ReadLine();
            var a = Console.ReadLine().Split();
            Console.ReadLine();
            var b = Console.ReadLine().Split();
            Console.WriteLine("{0}", a.Intersect(b).Count());
        }
    }
}