#include <bits/stdc++.h>
#define ll long long int
#define ff first
#define pb push_back
#define ss second
#define debug 0
#define ff first
#define mp make_pair
 
using namespace std;
 
const ll MOD = 1000000007LL;
 
ll fact[1000006];
ll ifact[1000006];
ll power2[1000006];
 
ll ar[200056];
ll br[200056];
ll dp[20005];
ll level[300005];
vector<int> adj[500005];

const long double pi=3.1415926535897;

set<string> st;
 
bool vis[500020];
 
bool prime[10000006];
 
vector<int> primes,pec,vec;

vector<pair<ll,ll> > vp;

map<ll,ll> has;
map<string,bool> source,dest;

ll day[300006];
 
 
 
ll powr (ll a, ll  b)
{
    if (b == 0)
        return 1;
    long long int x = powr(a, b/2);
    if (b % 2 == 0)
        return (x*x);
    else
        return ((x*x)*a);
}
 
inline ll inv(ll x) {
  return powr(x, MOD - 2);
}
 
inline ll mulMod(ll a, ll b) {
  return (a%MOD * b%MOD) % MOD;
 
}
 
inline void process() {
  fact[0] = 1;
  power2[0] = 1;
  for(int i = 1; i < 1003; i++) {
    fact[i] = mulMod(fact[i - 1], i);
    power2[i] = mulMod(power2[i - 1], 2);
  }
  ifact[1002] = inv(fact[1002]);
  for(int i = 1002 - 1; i >= 0; i--) {
    ifact[i] = mulMod(ifact[i + 1], i + 1);
  }
}
 
inline ll ncr(ll n, ll r) {
  if(n < r) return 0;
  return mulMod(fact[n], mulMod(ifact[r], ifact[(n - r)]));
}
 
 
void solve1(vector<ll> price, ll n, ll S[])
{
   
   stack<ll> st;
   st.push(0);
 
   S[0] = 1;
 
   for (ll i = 1; i < n; i++)
   {
 
      while (!st.empty() && price[st.top()] <= price[i])
         st.pop();
 
 
      S[i] = (st.empty())? (i + 1) : (i - st.top());
 
      st.push(i);
   }
}
 
void sieve()
{
    memset(prime,true,sizeof(prime));
    prime[0]=prime[1]=false;
    
    for(ll i=2;i*i<=100006;i++)
    {
        if(prime[i])
        {
            for(ll j=i*2;j<=100006;j+=i)
            {
                prime[j]=false;
            }
        }
    }
    
    for(int i=2;i<=100005;i++)
    {
    	if(prime[i])
    	primes.pb(i);
	}
}


int bfs(int s)
{
	vis[s]=1;
	queue<int> q,temp;
	
	vector<int>::iterator it;
	
	q.push(s);
	int siz=1;
	int lev=1;
	level[0]=ar[0];
	
	while(!q.empty())
	{
		int u=q.front();
		q.pop();
		siz--;
		
		for(it=adj[u].begin();it!=adj[u].end();++it)
		{
			if(!vis[*it])
			{
				q.push(*it);
				vis[*it]=1;
			}
			
		}
		
		if(siz==0)
		{
			siz=q.size();
			bool flag=0;
			ll val=0;
			while(!q.empty())
			{
				 val^=ar[q.front()];
				temp.push(q.front());
				q.pop();
			}
			
			if(val==0)
			{
				while(!temp.empty())
			{
				q.push(temp.front());
				temp.pop();
			}
			continue;
			}
			
			level[lev]=0;
			
			while(!temp.empty())
			{
				level[lev]^=ar[temp.front()];
				q.push(temp.front());
				temp.pop();
			}
			
			if(siz>0)
			lev++;
		}
	}
	
	return lev-1;
}


void solve(string pat, int M, int lps[])
{
   
    int len = 0;
 
    lps[0] = 0; 
 
    
    int i = 1;
    while (i < M)
    {
        if (pat[i] == pat[len])
        {
            len++;
            lps[i] = len;
            i++;
        }
        else 
        {
            if (len != 0)
            {
                len = lps[len-1];
 
            }
            else 
            {
                lps[i] = 0;
                i++;
            }
        }
    }
}
 

int main() 
{
//	freopen("input4.in","r",stdin);
//	freopen("output4.out","w",stdout);
    ll n,m,t,p,q,s,c,d,e,f,g,h,res=0,u,v,i,j,l=0,k,len,tot=0,rad,w,pos=0,y,r=0,z,x,maxm=-1;
	ll cycle,val,max1=-1,max2=0,num=0,zero,ans=0,min1,min2,sum=0;
    bool flag=0;
    ll a,b,minm=999999999999;
    ll x1,x2;
    
    string str,ptr,dtr,ktr;
    
   cin>>n;
   
   for(i=0;i<n;i++)
   {
   	cin>>ar[i];
   	has[ar[i]]++;
   }
   
   cin>>m;
   
   for(i=0;i<m;i++)
   {
   	cin>>br[i];
   }
   
   flag=0;
   for(i=0;i<m;i++)
   {
   	  if(has[br[i]]>0)
   	  {
   	  	has[br[i]]--;
		 }
		 else
		 {
		 	flag=1;
		 	break;
		 }
	}
	
	if(flag)
	cout<<"NO";
	else
	cout<<"YES"; 
   
    
	return 0;
    
}    

Measured memory_bytes: 31232