#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  set<int> stn;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    stn.insert(tmp);
  }
  int m;
  cin >> m;
  set<int> stm;
  for (int i = 0; i < m; i++) {
    int tmp;
    cin >> tmp;
    stm.insert(tmp);
  }

  if (includes(stn.begin(), stn.end(), stm.begin(), stm.end()))
  cout << 1 << endl;
  else
  cout << 0 << endl;
}
