object Main extends App {
  val in = new java.util.Scanner(System.in)
  val N = in.nextInt
  val X = BigInt(in.next, 2)
  val Zero = BigInt(0)

  
  def f(n: BigInt, cnt: Int): Int = {
    n.mod(n.bitCount) match {
      case Zero => cnt
      case m => f(m, cnt + 1)
    }
  }

  println(((N - 1 to 0 by -1).map {i => f(X.flipBit(i), 1)}).mkString("\n"))
}