#include #include #include #include using namespace std; struct cow { int start,over; int pos; bool operator <(const cow& b) const { if(over==b.over) return start>b.start; return over>b.over; } }; bool cmp(const cow& a,const cow& b) { if(a.start==b.start) return a.over bus; int use[50001]; cow cowx[50001]; int cnt=1; int main() { int n; while(scanf("%d",&n)==1) { for(int i=0; i