#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
  vector<int> a,b;
  int n,num;

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> num;
    a.push_back(num);
    //cout << num << endl;
  }

  cin >> n;

  for (int i = 0; i < n; i++) {
    cin >> num;
    b.push_back(num);
    //cout << num << endl;
  }

  cout << includes(a.begin(), a.end(), b.begin(), b.end()) << endl;

  return 0;
}

