Start: Jul, 05, 2019 08:40:00
2019年度暑期短学期达标测试
End: Jul, 05, 2019 11:40:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 110ms
Memory: 25316kB
Author: CT12812681281
In contest: 1281

a = int(input())
hhh = []
for i in range(a):
    m = input()
    if i == 0:
        hhh.append(m)
    else:
        x,y = map(int,m.split())
        flag = 0
        for j in range(len(hhh)):
            q,w = map(int,hhh[j].split())
            if (q>=x and w>=y) or (q>=y and w>=x):
                hhh[j] = m
                flag = 1
                break
        if flag == 0:
            hhh.append(m)
print(len(hhh))