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


def linearSearch(l, key):
    m = len(l)
    l.append(key)
    i = 0
    while l[i] != key:
        i += 1
    l.pop()
    if i == m:
        return "NOT_FOUND"
    return i


if __name__ == '__main__':

    n = int(input())
    S = [int(s) for s in input().split(" ")]
    q = int(input())
    T = [int(t) for t in input().split(" ")]

    count = 0
    for t in T:
        if linearSearch(S, t) != "NOT_FOUND":
            count += 1

    print(count)
 def linearSearch(l, key):
    m = len(l)
    l.append(key)
    i = 0
    while l[i] != key:
        i += 1
    l.pop()
    if i == m:
        return "NOT_FOUND"
    return i linearSearch m = len(l) m len(l) len l l.append(key) l.append l append key i = 0 i 0 while l[i] != key:
        i += 1
     l[i] != key l[i] l i key i += 1 i 1 l.pop() l.pop l pop if i == m:
        return "NOT_FOUND"
     i == m i m return "NOT_FOUND" "NOT_FOUND" return i i l l key key if __name__ == '__main__':

    n = int(input())
    S = [int(s) for s in input().split(" ")]
    q = int(input())
    T = [int(t) for t in input().split(" ")]

    count = 0
    for t in T:
        if linearSearch(S, t) != "NOT_FOUND":
            count += 1

    print(count) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input int(s) for s in input().split(" ") for s in input().split(" ") s input().split(" ") ().split () input split " " for s in input().split(" ") int(s) int s S = [int(s) for s in input().split(" ")] S [int(s) for s in input().split(" ")] q = int(input()) q int(input()) int input() input int(t) for t in input().split(" ") for t in input().split(" ") t input().split(" ") ().split () input split " " for t in input().split(" ") int(t) int t T = [int(t) for t in input().split(" ")] T [int(t) for t in input().split(" ")] count = 0 count 0 for t in T:
        if linearSearch(S, t) != "NOT_FOUND":
            count += 1

     t T if linearSearch(S, t) != "NOT_FOUND":
            count += 1

     linearSearch(S, t) != "NOT_FOUND" linearSearch(S, t) linearSearch S t "NOT_FOUND" count += 1 count 1 print(count) print count q = int(input()) int(input()) q n = int(input()) int(input()) n count = 0 0 count def linearSearch(l, key):
    m = len(l)
    l.append(key)
    i = 0
    while l[i] != key:
        i += 1
    l.pop()
    if i == m:
        return "NOT_FOUND"
    return i def linearSearch(l, key):
    m = len(l)
    l.append(key)
    i = 0
    while l[i] != key:
        i += 1
    l.pop()
    if i == m:
        return "NOT_FOUND"
    return i linearSearch S = [int(s) for s in input().split(" ")] [int(s) for s in input().split(" ")] S count += 1 1 count T = [int(t) for t in input().split(" ")] [int(t) for t in input().split(" ")] T
# -*- coding: utf-8 -*-


def linearSearch(l, key):
    m = len(l)
    l.append(key)
    i = 0
    while l[i] != key:
        i += 1
    l.pop()
    if i == m:
        return "NOT_FOUND"
    return i


if __name__ == '__main__':

    n = int(input())
    S = [int(s) for s in input().split(" ")]
    q = int(input())
    T = [int(t) for t in input().split(" ")]

    count = 0
    for t in T:
        if linearSearch(S, t) != "NOT_FOUND":
            count += 1

    print(count)

