Every interval containing person 1 has L=1. Increase the right endpoint R from 1. Once the first position R>1 with HR≥H1 is reached, that interval and every longer interval fail. Hence the answer is the number of positions before it. The time complexity is O(N).