#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

set<ll> a, b;

int main()
{
    int n, m;
    cin>>n;
    REP(i,n) {
        ll tmp_a;
        cin>>tmp_a;
        a.insert(tmp_a);
    }
    cin>>m;
    REP(i,m) {
        ll tmp_b;
        cin>>tmp_b;
        b.insert(tmp_b);
    }
    for (auto itr : b) {
        if (a.find(itr) == a.end()) {
            cout<<0<<endl;
            return 0;
        }
    }
    cout<<1<<endl;

    return 0;
}

