Problem:
Search II

You are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S.

Input

In the first line n is given. In the second line, n integers are given. In the third line q is given. Then, in the fourth line, q integers are given.

Output

Print C in a line.

Constraints

Elements in S is sorted in ascending order

n ≤ 100000

q ≤ 50000

0 ≤ an element in S ≤ 109

0 ≤ an element in T ≤ 109

Sample Input 1

5
1 2 3 4 5
3
3 4 1

Sample Output 1

3

Sample Input 2

3
1 2 3
1
5

Sample Output 2

0

Sample Input 3

5
1 1 2 2 3
2
1 2

Sample Output 3

2

Notes

Solution in C# (judge verdict: Accepted)

using System;

namespace teisyutusensei
{
    class Program
    {
        static void Main(string[] args)
        {
            ////?????????????????????
            string dmmy1 = Console.ReadLine();
            int n1 = int.Parse(dmmy1);
 
            string[] dmmySP = new string[n1];
            char del = ' ';

            string dmmy2 = Console.ReadLine();
            dmmySP = dmmy2.Split(del);
            int[] data1 = new int[n1];

            for (int i = 0; i < n1; i++)
            {
                data1[i] = int.Parse(dmmySP[i]);
            }
            ////?????????????????????
            string dmmy3 = Console.ReadLine();
            int n2 = int.Parse(dmmy3);

            string[] dmmySP2 = new string[n2];

            string dmmy4 = Console.ReadLine();
            dmmySP2 = dmmy4.Split(del);
            int[] data2 = new int[n2];

            int count = 0;

            for (int i = 0; i < n2; i++)
            {
                data2[i] = int.Parse(dmmySP2[i]);

                int left = 0;
                int right = n1;
                int mid = 0;

                while (left < right)
                {
                    mid = (left + right) / 2;

                    if (data1[mid] == data2[i])
                    {
                        count++;
                        break;
                    }
                    else if (data2[i] < data1[mid])
                    {
                        right = mid;
                    }
                    else
                    {
                        left = mid + 1;
                    }
                }

            }

            Console.WriteLine(count);
            Console.ReadLine();

        }
    }

}