longest increasing sequence (nlogn)