#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int NW,NB; vector< vector > X(2); int solve( int t ) { int ret = 0; int index[2] = { NW-1, NB-1 }; int x = INT_MAX; while ( true ) { bool is_end = true; for ( ; index[t] >= 0; index[t]-- ) { int a = X[t][index[t]]; if ( a < x ) { x = a; is_end = false; break; } } if ( is_end ) { break; } t = 1-t; ret++; } return ret; } int main() { cin >> NW; X[0].resize(NW); for ( int i = 0; i < NW; i++ ) { cin >> X[0][i]; } cin >> NB; X[1].resize(NB); for ( int i = 0; i < NB; i++ ) { cin >> X[1][i]; } sort( X[0].begin(), X[0].end() ); sort( X[1].begin(), X[1].end() ); cout << max( solve( 1 ), solve( 0 ) ) << endl; return 0; }