Annoula's Pattern
Annoula is learning about the binary system ( and ) at school and gets so excited that she decides to create a design using a sequence of digits consisting only of 0
and 1
.
Because she loves order and harmony, she decides that the sequence of numbers will always start with 0
, and the remaining digits will alternate, creating a beautiful pattern.
Totos observes her design and decides to mess with her.
When she is away, he goes and changes some 0
s to 1
s and some 1
s to 0
s, disrupting the pattern.
When Annoula returns, she sees that something is wrong and wants to fix the design.
Can you help Annoula calculate how many characters have been altered by Toto?
The input is the sequence of numbers after Totos has changed them.
The output is the number of digits that were altered.
Example
Input
0
1
0
1
1
1
0
0
0
1
Output
2
Comments