```scala
@annotation.tailrec
def loop(pos: Int, zeros: Int): Int =
  if(bsw.contains(pos)) zeros
  else loop(pos + 1, zeros + 1)

loop(bits, 1).toByte
```