#include <iostream>
#include <algorithm>
#include <set>

using namespace std;

int main()
{
    int N, M;
    cin >> N;
    set<int> Set;
    
    for(int i = 0; i < N; ++i)
    {
        int Num; cin >> Num;
        Set.insert(Num);
    }
    
    cin >> M;
    
    for(int i = 0; i < M; ++i)
    {
        int Num;
        cin >> Num;
        if(Set.find(Num) == Set.end())
        {
            cout << 0 << endl;
            return 0;
        }
        
    }
    
    cout << 1 << endl;
    
    return 0;
    
}
