# encoding: utf-8


class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        # print(len(set(array_1).intersection(set(array_2))))
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count)


if __name__ == '__main__':
    solution = Solution()
    solution.linear_search() class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        # print(len(set(array_1).intersection(set(array_2))))
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count) Solution def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        # print(len(set(array_1).intersection(set(array_2))))
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count) linear_search array_length_1 = int(input()) array_length_1 int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x array_1 = [int(x) for x in input().split()] array_1 [int(x) for x in input().split()] array_length_2 = int(input()) array_length_2 int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x array_2 = [int(x) for x in input().split()] array_2 [int(x) for x in input().split()] count = 0 count 0 for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
         i range(array_length_2) range array_length_2 if array_2[i] in array_1:
                count += 1
         array_2[i] in array_1 array_2[i] array_2 i array_1 count += 1 count 1 print(count) print count @staticmethod
     linear_search staticmethod linear_search if __name__ == '__main__':
    solution = Solution()
    solution.linear_search() __name__ == '__main__' __name__ '__main__' solution = Solution() solution Solution() Solution solution.linear_search() solution.linear_search solution linear_search solution = Solution() Solution() solution class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        # print(len(set(array_1).intersection(set(array_2))))
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count) class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        # print(len(set(array_1).intersection(set(array_2))))
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count) Solution
# encoding: utf-8


class Solution:
    @staticmethod
    def linear_search():
        array_length_1 = int(input())
        array_1 = [int(x) for x in input().split()]
        array_length_2 = int(input())
        array_2 = [int(x) for x in input().split()]

        # print(len(set(array_1).intersection(set(array_2))))
        count = 0
        for i in range(array_length_2):
            if array_2[i] in array_1:
                count += 1
        print(count)


if __name__ == '__main__':
    solution = Solution()
    solution.linear_search()