# 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(list(set(array_1).intersection(set(array_2)))))


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(list(set(array_1).intersection(set(array_2))))) 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(list(set(array_1).intersection(set(array_2))))) 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()] print(len(list(set(array_1).intersection(set(array_2))))) print len(list(set(array_1).intersection(set(array_2)))) len list(set(array_1).intersection(set(array_2))) list set(array_1).intersection(set(array_2)) (array_1).intersection (array_1) set array_1 intersection set(array_2) set array_2 @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 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(list(set(array_1).intersection(set(array_2))))) 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(list(set(array_1).intersection(set(array_2))))) Solution solution = Solution() Solution() 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(list(set(array_1).intersection(set(array_2)))))


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