Two-Face and the Game

0

0 votes
Very-Easy
Problem

Harvey Dent, previously one of the strongest allies of Batman has now become a schizoid criminal mastermind obsessed with duality and the number two. He has got hold of Sal Maroni and he uses his one side defaced silver dollar to find that Maroni is lucky and thus does not shoot him. However, Harvey thinks of an idea for once again deciding Maroni's fate. He has a device with 9 LEDs (and their switches) arranged in a 3 x 3 grid. Intially all the LEDs are switched on.

Pressing any of the lights will toggle it and all its side-adjacent lights. We consider the toggling as follows: if the light was switched on then it will be switched off, if it was switched off then it will be switched on.

Harvey asks Maroni to tell the number of lights that will be switched on, given the number of times Maroni's driver has pressed each switch. If the number Maroni tells Harvey is correct and a multiple of two, Maroni lives. Otherwise, Maroni dies.

Help Maroni determine the number of LEDs that are switched on, given the number of times each switch is pressed.

Input

The input consists of a 3 x 3 matrix. The j-th number in the i-th row is the number of times the j-th light of the i-th row of the grid is pressed.

Output

Output a single number: the number of lights that are switched on.

Constraints

Number of times a light switch is pressed <= 100.

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

After pressing the switches as in the sample test case, state of the LED device will be:

0 0 1
0 1 0
1 0 0

where 1 denotes turned on LED.

Editor Image

?