#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int n,a,q,b;
    std::deque<int> deq1;
    deque<int> deq2;
    cin >>n;
    for (int i=0;i<n;i++) {
        cin >> a;
        deq1.emplace_back(a);
    }
    cin >> q;
    for (int j=0;j<q;j++) {
        cin >> b;
        deq2.emplace_back(b);
    }
    if ( includes(deq1.begin(),deq1.end(),deq2.begin(),deq2.end())==true ) {
        cout << "1" << endl;
    } else {
        cout << "0" << endl;
    }
}
