from collections import Counter

def main():

    n = int(eval(input()))

    D = list(map(int, input().split()))

    m = int(eval(input()))

    T = list(map(int, input().split()))

    C = Counter(D)

    for t in T:

        if t not in C or C[t] == 0:

            print('NO')

            return

        else:

            C[t] -= 1

    print('YES')

main()
def main():

    n = int(eval(input()))

    D = list(map(int, input().split()))

    m = int(eval(input()))

    T = list(map(int, input().split()))

    dic = dict()

    

    # 辞書はDだけで十分.Counterより速い.

    for d in D:

        if dic.get(d):

            dic[d] += 1

        else:

            dic[d] = 1

            

    for t in T:

        if t not in dic or dic[t] == 0:

            print('NO')

            return

        else:

            dic[t] -= 1

    print('YES')

main()
from collections import Counter


def main():
    n = int(eval(input()))
    D = list(map(int, input().split()))
    m = int(eval(input()))
    T = list(map(int, input().split()))
    C = Counter(D)
    for t in T:
        if t not in C or C[t] == 0:
            print("NO")
            return
        else:
            C[t] -= 1
    print("YES")


main()

def main():
    n = int(eval(input()))
    D = list(map(int, input().split()))
    m = int(eval(input()))
    T = list(map(int, input().split()))
    dic = dict()
    # 辞書はDだけで十分.Counterより速い.
    for d in D:
        if dic.get(d):
            dic[d] += 1
        else:
            dic[d] = 1
    for t in T:
        if t not in dic or dic[t] == 0:
            print("NO")
            return
        else:
            dic[t] -= 1
    print("YES")


main()

-from collections import Counter - - -    C = Counter(D) +    dic = dict() +    # 辞書はDだけで十分.Counterより速い. +    for d in D: +        if dic.get(d): +            dic[d] += 1 +        else: +            dic[d] = 1 -        if t not in C or C[t] == 0: +        if t not in dic or dic[t] == 0: -            C[t] -= 1 +            dic[t] -= 1