def answer(meetings):
    # sort by start time
    meetings.sort(key=lambda x: x[1])
    
    # curr = earliest start time
    curr, _ = sorted(meetings)[0]
    count = 0
    
    for m in meetings:
        start, end = m
        if start >= curr:
            count += 1
            curr = end
    
    return count
            
    
def tests():
    one_overlap = [[0, 1], [1, 2], [2, 3], [3, 5], [4, 5]]
    print(answer(one_overlap))
    assert answer(one_overlap) == 4
    
    
tests()