#include <bits/stdc++.h>

using namespace std;

#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define rep(i, n) reps(i, 0, (n))
#define all(v) (v).begin(), (v).end()

int main() {
    int n; cin >> n;
    vector<int> v(n);
    rep(i, n) cin >> v[i];
    int m; cin >> m;
    vector<int> u(m);
    rep(i, m) cin >> u[i];
    cout << includes(all(v), all(u)) << endl;
}
