#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> a(n);
  for(Int i=0;i<n;i++) cin>>a[i];
  Int m;
  cin>>m;
  vector<Int> b(m);
  for(Int i=0;i<m;i++) cin>>b[i];
  cout<<includes(a.begin(),a.end(),b.begin(),b.end())<<endl;
  return 0;
}

