3.1. 15이원준 ¶
#include<iostream>
#include<map>
#include<utility>
using namespace std;
int main(){
  int N, ans = 0;
  multimap<int, int, less<int>> arr;
  cin>> N;
  for(int i = 0; i<N; i++){
    int tmp1, tmp2;
    scanf("%d %d", &tmp1, &tmp2);
    arr.insert(pair<int, int>(tmp1, tmp2));
  }
  for(auto it = arr.begin(); it != arr.end();){
    int firstfinish = it->second;
    for(it++; it != arr.end() && it->first < firstfinish; it++){
      int etime = it->second;
      if(etime < firstfinish){
        firstfinish = etime;
      }
    }
    ans++;
  }
  cout<< ans << endl;
}













