ENIGMA-0x02 (2024) - J4 (Annoula's Pattern)

View as PDF

Submit solution

Points: 100 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem types
Allowed languages
Blockly, C, C++, Java, Pascal, Python

Annoula's Pattern

Annoula is learning about the binary system (0 and 1) at school and gets so excited that she decides to create a design using a sequence of 10 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 0s to 1s and some 1s to 0s, 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 10 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

There are no comments at the moment.