import sys
import heapq
input = sys.stdin.readline
N = int(input())
lecture = [list(map(int, input().split())) for _ in range(N)]
lecture.sort(key=lambda x: x[1])
room = []
cnt = 0
for lec in lecture:
while room and room[0] <= lec[1]: # 가장 일찍 끝나는 시간보다 시작 시간이 크면
heapq.heappop(room) # room에서 가장 작은 원소 pop & return
heapq.heappush(room, lec[2]) # room에 i[2]=끝나는 시간을 추가
cnt = max(cnt, len(room))
print(cnt)