Remove duplicates from sorted array