Replace MinIndex/MaxIndex with Length