21 lines
342 B
Python
21 lines
342 B
Python
import sys
|
|
|
|
input = sys.stdin.readline
|
|
|
|
N = int(input().rstrip())
|
|
arr = []
|
|
|
|
for i in range(N):
|
|
j, k = map(int, input().split())
|
|
arr.append((j,k))
|
|
|
|
arr.sort(key=lambda x : (x[1], x[0])) #중요, 블로그에 메모해두기
|
|
|
|
min_val=-1
|
|
tot=0
|
|
for start, end in arr:
|
|
if(min_val<=start):
|
|
min_val=end
|
|
tot+=1
|
|
|
|
print(tot) |