#include using namespace std; #define REP(i,a,b) for(i=a;i'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);} void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);} template void writerLn(T x){writer(x,'\n');} int As, A[20], Bs, B[20]; int main(){ int i, j, k, loop; int res = 0, tmp; int a, b; reader(&As); rep(i,As) reader(A+i); reader(&Bs); rep(i,Bs) reader(B+i); sort(A,A+As); sort(B,B+Bs); rep(loop,2){ a = As-1; b = Bs-1; tmp = 0; k = 1000; for(;;){ while(a >= 0 && A[a] >= k) a--; if(a < 0) break; k = A[a]; tmp++; a--; while(b >= 0 && B[b] >= k) b--; if(b < 0) break; k = B[b]; tmp++; b--; } res = max(res, tmp); swap(As, Bs); rep(i,max(As,Bs)) swap(A[i],B[i]); } writerLn(res); return 0; }