#include using namespace std; struct Query { int length; bool type; bool operator<(const Query& q) const { return(length < q.length); } }; int main() { vector< Query > query; for(int i = 0; i < 2; i++) { int N; cin >> N; while(N--) { int Digit; cin >> Digit; query.push_back((Query){Digit, i}); } } sort(query.begin(), query.end()); int height = 0, type = -1, length = -1; for(int i = 0; i < query.size(); i++) { Query& q = query[i]; if(type != q.type && length < q.length) { height++; type = q.type; length = q.length; } } cout << height << endl; }