title: How can I understand the result of this testcase in this code challenge?
body: <p>I am trying to understand the first testcase of this <a href="http://codeforces.com/contest/465/problem/A" rel="nofollow noreferrer">challenge</a> in codeforces.</p>
  <p>The description is:</p>
  <blockquote>
  <p>Sergey is testing a next-generation processor. Instead of bytes the processor works with memory cells consisting of n bits. These bits are numbered from 1 to n. An integer is stored in the cell in the following way: the least significant bit is stored in the first bit of the cell, the next significant bit is stored in the second bit, and so on; the most significant bit is stored in the n-th bit.
  Now Sergey wants to test the following instruction: &quot;add 1 to the value of the cell&quot;. As a result of the instruction, the integer that is written in the cell must be increased by one; if some of the most significant bits of the resulting number do not fit into the cell, they must be discarded.
  Sergey wrote certain values ​​of the bits in the cell and is going to add one to its value. How many bits of the cell will change after the operation?</p>
  </blockquote>
  <p><strong>Summary</strong></p>
  <p>Given a binary number, add 1 to its decimal value, count how many bits change after the operation?</p>
  <p>Testcases</p>
  <blockquote>
  <p>4</p>
  <p>1100<br />
  = 3</p>
  <p>4</p>
  <p>1111<br />
  = 4</p>
  </blockquote>
  <p><strong>Note
  In the first sample the cell ends up with value 0010, in the second sample — with 0000.</strong></p>
  <p>In the 2 test case 1111 is 15, so 15 + 1 =  16 (10000 in binary), so all the 1's change, therefore is 4</p>
  <p>But in the 2 test case 1100  is 12, so 12 + 1 = 13 (01101), here just the left 1 at the end changes, but the result is 3 why?</p>