inList() optimization for the cases on 0 and 1 entries