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

int main(){
	int n, m, i, t;
    vector<int> a, b;

	cin >> n;
	for (i = 0; i < n; i++){
      cin >> t;
      a.push_back(t);
	}

	cin >> m;
	for (i = 0; i < m; i++){
	  cin >> t;
	  b.push_back(t);
	}
    
    for (auto x : b){
      if(!binary_search(a.begin(), a.end(), x)){
    	cout << 0 << endl;
    	exit(0);
      }
    }

    cout << 1 << endl;
}
