#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; const int INF=1<<29; int n,m,a[10],b[10]; int cap[10]; int dfs(int i){ if(i==n) return m-count(cap,cap+m,0); int res=INF; rep(j,m) if(cap[j]+a[i]<=b[j]) { cap[j]+=a[i]; res=min(res,dfs(i+1)); cap[j]-=a[i]; if(cap[j]==0) break; } return res; } int main(){ scanf("%d",&n); rep(i,n) scanf("%d",&a[i]); scanf("%d",&m); rep(j,m) scanf("%d",&b[j]); sort(a,a+n,greater()); sort(b,b+m,greater()); int ans=dfs(0); printf("%d\n",ans