#include <iostream>
#include <vector>
#include <algorithm>


int main()
{
    int n,m;
    std::vector<long long> a;
    std::vector<long long> b;
    std::cin>>n;
    for(int i = 0; i < n; i++)
    {
        int hoge;
        std::cin>>hoge;
        a.push_back(hoge);
    }
    std::cin>>m;
    for(int i = 0; i < m; i++)
    {
        int hoge;
        std::cin>>hoge;
        b.push_back(hoge);
    }
    int check = 0;
    for(int i = 0; i < m; i++)
    {
        if (binary_search(a.begin(),a.end(), b[i])){check++;}
    }
    if(check==m)
    {
        std::cout<<1<<std::endl;
    }else
    {
        std::cout<<0<<std::endl;
    }
    return 0;
}

