use which to turn logical index into an integer one