Help me in solving ZCO15003 problem

My issue

What can’t we sort the array based on first element?

My code

# cook your dish here
n = int(input())
a = [None] * n
for i in range(n):
    a[i] = list(map(int, input().split()))
a.sort()
ans = 0
mtn = -1
for i in range(0, n):
    if a[i][0] > mtn:
        ans += 1
        mtn = a[i][1]
print(ans)

Learning course: Greedy Algorithms
Problem Link: Covering Practice Problem in Greedy Algorithms - CodeChef