common elements in sorted array