def linear_search(l, key):
    _l = l + [key]

    i = 0
    while key != _l[i]:
        i += 1

    if i == len(_l) - 1:
        return -1

    return i


if __name__ == '__main__':
    n = input()
    s = input().split()
    q = input()
    t = input().split()

    ans = 0
    for c1 in t:
        if linear_search(s, c1) >= 0:
            ans += 1

    print(ans) def linear_search(l, key):
    _l = l + [key]

    i = 0
    while key != _l[i]:
        i += 1

    if i == len(_l) - 1:
        return -1

    return i linear_search _l = l + [key] _l l + [key] l [key] key i = 0 i 0 while key != _l[i]:
        i += 1

     key != _l[i] key _l[i] _l i i += 1 i 1 if i == len(_l) - 1:
        return -1

     i == len(_l) - 1 i len(_l) - 1 len(_l) len _l 1 return -1 -1 return i i l l key key if __name__ == '__main__':
    n = input()
    s = input().split()
    q = input()
    t = input().split()

    ans = 0
    for c1 in t:
        if linear_search(s, c1) >= 0:
            ans += 1

    print(ans) __name__ == '__main__' __name__ '__main__' n = input() n input() input s = input().split() s input().split() ().split () input split q = input() q input() input t = input().split() t input().split() ().split () input split ans = 0 ans 0 for c1 in t:
        if linear_search(s, c1) >= 0:
            ans += 1

     c1 t if linear_search(s, c1) >= 0:
            ans += 1

     linear_search(s, c1) >= 0 linear_search(s, c1) linear_search s c1 0 ans += 1 ans 1 print(ans) print ans n = input() input() n ans += 1 1 ans s = input().split() input().split() s ans = 0 0 ans t = input().split() input().split() t def linear_search(l, key):
    _l = l + [key]

    i = 0
    while key != _l[i]:
        i += 1

    if i == len(_l) - 1:
        return -1

    return i def linear_search(l, key):
    _l = l + [key]

    i = 0
    while key != _l[i]:
        i += 1

    if i == len(_l) - 1:
        return -1

    return i linear_search q = input() input() q
def linear_search(l, key):
    _l = l + [key]

    i = 0
    while key != _l[i]:
        i += 1

    if i == len(_l) - 1:
        return -1

    return i


if __name__ == '__main__':
    n = input()
    s = input().split()
    q = input()
    t = input().split()

    ans = 0
    for c1 in t:
        if linear_search(s, c1) >= 0:
            ans += 1

    print(ans)