# encoding: utf-8


import sys


class Solution:
    def __init__(self):
        """
        init input array
        """
        self.__input = sys.stdin.readlines()

    @property
    def solution(self):
        length_1 = int(self.__input[0])
        array_1 = list(map(int, self.__input[1].split()))
        length_2 = int(self.__input[2])
        array_2 = list(map(int, self.__input[3].split()))

        assert length_1 == len(array_1) and length_2 == len(array_2)

        count = 0
        for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

        return str(count)

    @staticmethod
    def linear_search(key, array, array_length):
        # print(len(set(array_1).intersection(set(array_2))))
        for i in range(array_length):
            if array[i] == key:
                return True
        return False


if __name__ == '__main__':
    case = Solution()
    print(case.solution) import sys sys class Solution:
    def __init__(self):
        """
        init input array
        """
        self.__input = sys.stdin.readlines()

    @property
    def solution(self):
        length_1 = int(self.__input[0])
        array_1 = list(map(int, self.__input[1].split()))
        length_2 = int(self.__input[2])
        array_2 = list(map(int, self.__input[3].split()))

        assert length_1 == len(array_1) and length_2 == len(array_2)

        count = 0
        for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

        return str(count)

    @staticmethod
    def linear_search(key, array, array_length):
        # print(len(set(array_1).intersection(set(array_2))))
        for i in range(array_length):
            if array[i] == key:
                return True
        return False Solution def __init__(self):
        """
        init input array
        """
        self.__input = sys.stdin.readlines()

     __init__ """
        init input array
        """ self.__input = sys.stdin.readlines() self.__input self __input sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines self self def solution(self):
        length_1 = int(self.__input[0])
        array_1 = list(map(int, self.__input[1].split()))
        length_2 = int(self.__input[2])
        array_2 = list(map(int, self.__input[3].split()))

        assert length_1 == len(array_1) and length_2 == len(array_2)

        count = 0
        for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

        return str(count)

     solution length_1 = int(self.__input[0]) length_1 int(self.__input[0]) int self.__input[0] self.__input self __input 0 array_1 = list(map(int, self.__input[1].split())) array_1 list(map(int, self.__input[1].split())) list map(int, self.__input[1].split()) map int self.__input[1].split() self.__input[1].split self.__input[1] self.__input self __input 1 split length_2 = int(self.__input[2]) length_2 int(self.__input[2]) int self.__input[2] self.__input self __input 2 array_2 = list(map(int, self.__input[3].split())) array_2 list(map(int, self.__input[3].split())) list map(int, self.__input[3].split()) map int self.__input[3].split() self.__input[3].split self.__input[3] self.__input self __input 3 split assert length_1 == len(array_1) and length_2 == len(array_2) length_1 == len(array_1) and length_2 == len(array_2) length_1 == len(array_1) length_1 len(array_1) len array_1 length_2 == len(array_2) length_2 len(array_2) len array_2 count = 0 count 0 for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

         each array_2 if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

         self.linear_search(key=each, array=array_1, array_length=length_1) self.linear_search self linear_search key=each key each array=array_1 array array_1 array_length=length_1 array_length length_1 count += 1 count 1 return str(count) str(count) str count self self @property
     solution property solution def linear_search(key, array, array_length):
        # print(len(set(array_1).intersection(set(array_2))))
        for i in range(array_length):
            if array[i] == key:
                return True
        return False linear_search for i in range(array_length):
            if array[i] == key:
                return True
         i range(array_length) range array_length if array[i] == key:
                return True
         array[i] == key array[i] array i key return True True return False False key key array array array_length array_length @staticmethod
     linear_search staticmethod linear_search if __name__ == '__main__':
    case = Solution()
    print(case.solution) __name__ == '__main__' __name__ '__main__' case = Solution() case Solution() Solution print(case.solution) print case.solution case solution class Solution:
    def __init__(self):
        """
        init input array
        """
        self.__input = sys.stdin.readlines()

    @property
    def solution(self):
        length_1 = int(self.__input[0])
        array_1 = list(map(int, self.__input[1].split()))
        length_2 = int(self.__input[2])
        array_2 = list(map(int, self.__input[3].split()))

        assert length_1 == len(array_1) and length_2 == len(array_2)

        count = 0
        for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

        return str(count)

    @staticmethod
    def linear_search(key, array, array_length):
        # print(len(set(array_1).intersection(set(array_2))))
        for i in range(array_length):
            if array[i] == key:
                return True
        return False class Solution:
    def __init__(self):
        """
        init input array
        """
        self.__input = sys.stdin.readlines()

    @property
    def solution(self):
        length_1 = int(self.__input[0])
        array_1 = list(map(int, self.__input[1].split()))
        length_2 = int(self.__input[2])
        array_2 = list(map(int, self.__input[3].split()))

        assert length_1 == len(array_1) and length_2 == len(array_2)

        count = 0
        for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

        return str(count)

    @staticmethod
    def linear_search(key, array, array_length):
        # print(len(set(array_1).intersection(set(array_2))))
        for i in range(array_length):
            if array[i] == key:
                return True
        return False Solution case = Solution() Solution() case
# encoding: utf-8


import sys


class Solution:
    def __init__(self):
        """
        init input array
        """
        self.__input = sys.stdin.readlines()

    @property
    def solution(self):
        length_1 = int(self.__input[0])
        array_1 = list(map(int, self.__input[1].split()))
        length_2 = int(self.__input[2])
        array_2 = list(map(int, self.__input[3].split()))

        assert length_1 == len(array_1) and length_2 == len(array_2)

        count = 0
        for each in array_2:
            if self.linear_search(key=each, array=array_1, array_length=length_1):
                count += 1

        return str(count)

    @staticmethod
    def linear_search(key, array, array_length):
        # print(len(set(array_1).intersection(set(array_2))))
        for i in range(array_length):
            if array[i] == key:
                return True
        return False


if __name__ == '__main__':
    case = Solution()
    print(case.solution)