import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.StringTokenizer; public class Solution { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } public static void main(String[] args) { FastReader sc = new FastReader(); int n=sc.nextInt(); Node[] p=new Node[n]; int[] xx =new int[n]; Node[] pp =new Node[n]; long ans=0; for(int i=0;i() { @Override public int compare(Node o1, Node o2) { return o2.po-o1.po; } }); int m=sc.nextInt(); int[] yi= new int[m]; for(int i=0;i=min && pp[j].lo<=max)pp[j].ck=true; } for(int i=0;i