Binary counter incrementing [00SX]

Consider the following problem.

Input: an array B[0\dots ] representing a binary number n. (Each B[i] is a single bit representing the coefficient of 2^i. Assume B is sufficiently large so we don’t have to worry about problems with overflow.)

Output: Increment the binary number, that is, modify B so that it represents the number n+1.