William own flat central London he decide rent flat n day earn moneySince flat center city instantly get m offer form l_i r_i mean want book flat day l_i day r_i inclusive to avoid spend lot time figure profitable accept offer William decide develop algorithm the algorithm process offer arrive accept offer follow condition satisfied r_i l_i 1 ge x None day l_i r_i occupy previously accept offer William is not sure value x ask help for x 1 n wants calculate total number day flat occupy corresponding value assign x