#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++){
        cin >> v[i];
    }
    sort(v.begin() , v.end());
    int m;
    cin >> m;
    vector<int> v2(m);
    for(int i = 0; i < m; i++){
        cin >> v2[i];
    }
    sort(v2.begin(), v2.end());

    for(int i = 0; i< m; i++){
        int p;
        p = v2[i];
        if(std::binary_search(v.begin(), v.end(), p)){
            //cout << 1 << endl;
        }
        else {
            cout << 0 << endl;
            return 0;
        }
    }
    cout << 1 << endl;
}
