Find first and last positions of an element in a sorted array.