#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
	int	N;
	cin >> N;
	vector<int> vec1(N);
	rep(i, N)
		cin >> vec1.at(i);
	int	M;
	cin >> M;
	vector<int> vec2(M);
	rep(i, M)
		cin >> vec2.at(i);
	cout << includes(vec1.begin(), vec1.end(), vec2.begin(), vec2.end()) << endl;
}

