Post History
Given an integer, output the number of lone 1s in its binary representation. Input An integer from $0$ to $4294967295$ (that is, $2^{32}-1$). In binary that's from 00000000000000000000000000000...
#1: Initial revision
Lone ones
Given an integer, output the number of lone `1`s in its binary representation.
## Input
- An integer from $0$ to $4294967295$ (that is, $2^{32}-1$). In binary that's from `00000000000000000000000000000000` to `11111111111111111111111111111111`.
- You may take input in any form that does not contribute to solving the challenge. For example:
- A signed or unsigned integer of $32$ bits or more.
- A string of decimal digits.
- A binary string.
- A sequence of bits.
## Output
- The number of `1`s in the binary representation that do not have a `1` to their left or right.
- For avoidance of doubt:
- A `1` at the left end of the binary representation does not have a `1` to its left.
- A `1` at the right end of the binary representation does not have a `1` to its right.
## Examples
Input $4$ corresponds to `100` in binary. The output is $1$ because there is $1$ `1` bit that is not adjacent to another `1` bit.
Input $5$ corresponds to `101` in binary. The output is $2$ because there are $2$ `1` bits that are not adjacent to another `1` bit.
Input $6$ corresponds to `110` in binary. The output is $0$ because each of the `1` bits is adjacent to another `1` bit.
## Test cases
Test cases are in the format `input : output`.
### Unsigned integer test cases
```text
0 : 0
4294967295 : 0
2147483648 : 1
1 : 1
2147483649 : 2
98304 : 0
1310720 : 2
4294639615 : 1
4294967294 : 0
2147483647 : 0
3221225471 : 1
4294967293 : 1
2863311530 : 16
1431655765 : 16
1717986918 : 0
```
### Binary test cases
```text
00000000000000000000000000000000 : 0
11111111111111111111111111111111 : 0
10000000000000000000000000000000 : 1
00000000000000000000000000000001 : 1
10000000000000000000000000000001 : 2
00000000000000011000000000000000 : 0
00000000000101000000000000000000 : 2
11111111111110101111111111111111 : 1
11111111111111111111111111111110 : 0
01111111111111111111111111111111 : 0
10111111111111111111111111111111 : 1
11111111111111111111111111111101 : 1
10101010101010101010101010101010 : 16
01010101010101010101010101010101 : 16
01100110011001100110011001100110 : 0
```
## Scoring
This is a [code golf challenge]. Your score is the number of bytes in your code. Lowest score for each language wins.
> Explanations are optional, but I'm more likely to upvote answers that have one.
[code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
