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

using namespace std;

vector<int> parse() {
  int n, x;
  cin >> n;
  vector<int> A;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    A.push_back(x);
  }
  return A;
}

int main() {
  auto A = parse();
  auto B = parse();
  cout << includes(A.begin(), A.end(), B.begin(), B.end()) << endl;
}
