import sys

ERROR_INPUT = 'input is invalid'
ERROR_INPUT_NOT_UNIQUE = 'input is not unique'


def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        if linner_search(S, t):
            count += 1

    print(count)


def linner_search(li, key):
    li.append(key)
    i = 0
    while li[i] != key:
        i += 1

    return i != len(li) - 1


def get_input1():
    n = int(input())
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li


def get_input2():
    n = int(input())
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li


main() import sys sys ERROR_INPUT = 'input is invalid' ERROR_INPUT 'input is invalid' ERROR_INPUT_NOT_UNIQUE = 'input is not unique' ERROR_INPUT_NOT_UNIQUE 'input is not unique' def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        if linner_search(S, t):
            count += 1

    print(count) main S = get_input1() S get_input1() get_input1 T = get_input2() T get_input2() get_input2 count = 0 count 0 for t in T:
        if linner_search(S, t):
            count += 1

     t T if linner_search(S, t):
            count += 1

     linner_search(S, t) linner_search S t count += 1 count 1 print(count) print count def linner_search(li, key):
    li.append(key)
    i = 0
    while li[i] != key:
        i += 1

    return i != len(li) - 1 linner_search li.append(key) li.append li append key i = 0 i 0 while li[i] != key:
        i += 1

     li[i] != key li[i] li i key i += 1 i 1 return i != len(li) - 1 i != len(li) - 1 i len(li) - 1 len(li) len li 1 li li key key def get_input1():
    n = int(input())
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li get_input1 n = int(input()) n int(input()) int input() input if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

     n > 10000 n 10000 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 li = [] li [] for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

     x input().split(' ') ().split () input split ' ' if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
         int(x) < 0 or int(x) > 10 ** 9 int(x) < 0 int(x) int x 0 int(x) > 10 ** 9 int(x) int x 10 ** 9 10 9 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 li.append(x) li.append li append x return li li def get_input2():
    n = int(input())
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li get_input2 n = int(input()) n int(input()) int input() input if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

     n > 500 n 500 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 li = [] li [] for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

     x input().split(' ') ().split () input split ' ' if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
         int(x) < 0 or int(x) > 10 ** 9 int(x) < 0 int(x) int x 0 int(x) > 10 ** 9 int(x) int x 10 ** 9 10 9 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
         int(x) in li int(x) int x li print(ERROR_INPUT_NOT_UNIQUE) print ERROR_INPUT_NOT_UNIQUE sys.exit(1) sys.exit sys exit 1 li.append(x) li.append li append x return li li main() main def get_input2():
    n = int(input())
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li def get_input2():
    n = int(input())
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li get_input2 def get_input1():
    n = int(input())
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li def get_input1():
    n = int(input())
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li get_input1 def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        if linner_search(S, t):
            count += 1

    print(count) def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        if linner_search(S, t):
            count += 1

    print(count) main def linner_search(li, key):
    li.append(key)
    i = 0
    while li[i] != key:
        i += 1

    return i != len(li) - 1 def linner_search(li, key):
    li.append(key)
    i = 0
    while li[i] != key:
        i += 1

    return i != len(li) - 1 linner_search ERROR_INPUT = 'input is invalid' 'input is invalid' ERROR_INPUT ERROR_INPUT_NOT_UNIQUE = 'input is not unique' 'input is not unique' ERROR_INPUT_NOT_UNIQUE
import sys

ERROR_INPUT = 'input is invalid'
ERROR_INPUT_NOT_UNIQUE = 'input is not unique'


def main():
    S = get_input1()
    T = get_input2()

    count = 0
    for t in T:
        if linner_search(S, t):
            count += 1

    print(count)


def linner_search(li, key):
    li.append(key)
    i = 0
    while li[i] != key:
        i += 1

    return i != len(li) - 1


def get_input1():
    n = int(input())
    if n > 10000:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        li.append(x)

    return li


def get_input2():
    n = int(input())
    if n > 500:
        print(ERROR_INPUT)
        sys.exit(1)

    li = []
    for x in input().split(' '):
        if int(x) < 0 or int(x) > 10 ** 9:
            print(ERROR_INPUT)
            sys.exit(1)
        elif int(x) in li:
            print(ERROR_INPUT_NOT_UNIQUE)
            sys.exit(1)
        li.append(x)

    return li


main()