# -*- coding: utf-8 -*-


def main():
    s_length = raw_input()
    s = set(raw_input().strip().split(' '))
    t_length = raw_input()
    t = set(raw_input().strip().split(' '))

    print len(s.intersection(t))

if __name__ == '__main__':
    main() def main():
    s_length = raw_input()
    s = set(raw_input().strip().split(' '))
    t_length = raw_input()
    t = set(raw_input().strip().split(' '))

    print len(s.intersection(t)) main s_length = raw_input() s_length raw_input() raw_input s = set(raw_input().strip().split(' ')) s set(raw_input().strip().split(' ')) set raw_input().strip().split(' ') ().strip().split ().strip() ().strip () raw_input strip split ' ' t_length = raw_input() t_length raw_input() raw_input t = set(raw_input().strip().split(' ')) t set(raw_input().strip().split(' ')) set raw_input().strip().split(' ') ().strip().split ().strip() ().strip () raw_input strip split ' ' print len(s.intersection(t)) len s.intersection(t) s.intersection s intersection t if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    s_length = raw_input()
    s = set(raw_input().strip().split(' '))
    t_length = raw_input()
    t = set(raw_input().strip().split(' '))

    print len(s.intersection(t)) def main():
    s_length = raw_input()
    s = set(raw_input().strip().split(' '))
    t_length = raw_input()
    t = set(raw_input().strip().split(' '))

    print len(s.intersection(t)) main
# -*- coding: utf-8 -*-


def main():
    s_length = raw_input()
    s = set(raw_input().strip().split(' '))
    t_length = raw_input()
    t = set(raw_input().strip().split(' '))

    print len(s.intersection(t))

if __name__ == '__main__':
    main()