"""
def LinearSearch1(S, n, t):
    for i in range(n):
        if S[i] == t:
            return i
            break
    else:
        return -1
"""

def LinearSearch2(S, n, t):
    S.append(t)
    i = 0

    while S[i] != t:
        i += 1

    S.pop()
    if i == n:
        return -1
    else:
        return i


n = int(input())
S = [int(s) for s in input().split()]

q = int(input())
T = {int(t) for t in input().split()}

# ans = sum(LinearSearch1(S, n, t) >= 0 for t in T)
ans = sum(LinearSearch2(S, n, t) >= 0 for t in T)

print(ans) """
def LinearSearch1(S, n, t):
    for i in range(n):
        if S[i] == t:
            return i
            break
    else:
        return -1
""" def LinearSearch2(S, n, t):
    S.append(t)
    i = 0

    while S[i] != t:
        i += 1

    S.pop()
    if i == n:
        return -1
    else:
        return i LinearSearch2 S.append(t) S.append S append t i = 0 i 0 while S[i] != t:
        i += 1

     S[i] != t S[i] S i t i += 1 i 1 S.pop() S.pop S pop if i == n:
        return -1
    else:
        return i i == n i n return -1 -1 return i i S S n n t t 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 ans = sum(LinearSearch2(S, n, t) >= 0 for t in T) ans sum(LinearSearch2(S, n, t) >= 0 for t in T) sum LinearSearch2(S, n, t) >= 0 LinearSearch2(S, n, t) LinearSearch2 S n t 0 print(ans) print ans T = {int(t) for t in input().split()} T S = [int(s) for s in input().split()] [int(s) for s in input().split()] S n = int(input()) int(input()) n q = int(input()) int(input()) q def LinearSearch2(S, n, t):
    S.append(t)
    i = 0

    while S[i] != t:
        i += 1

    S.pop()
    if i == n:
        return -1
    else:
        return i def LinearSearch2(S, n, t):
    S.append(t)
    i = 0

    while S[i] != t:
        i += 1

    S.pop()
    if i == n:
        return -1
    else:
        return i LinearSearch2 ans = sum(LinearSearch2(S, n, t) >= 0 for t in T) sum(LinearSearch2(S, n, t) >= 0 for t in T) ans
"""
def LinearSearch1(S, n, t):
    for i in range(n):
        if S[i] == t:
            return i
            break
    else:
        return -1
"""

def LinearSearch2(S, n, t):
    S.append(t)
    i = 0

    while S[i] != t:
        i += 1

    S.pop()
    if i == n:
        return -1
    else:
        return i


n = int(input())
S = [int(s) for s in input().split()]

q = int(input())
T = {int(t) for t in input().split()}

# ans = sum(LinearSearch1(S, n, t) >= 0 for t in T)
ans = sum(LinearSearch2(S, n, t) >= 0 for t in T)

print(ans)