EEPROM
문제
Mirko and Stanko each have one EEPROM rectangular memory module consisting of R×16 bits.
They also have the circuitry needed to write data into the memory module. In one operation they can change the state of a contiguous sequence of bits in a row or column.
Mirko and Stanko's dad asked them to write a particular arrangement of bits into their memory modules. Whoever is faster will get repeats for lunch so Mirko is looking for a program which will help him win.
Write a program which will determine the smallest possible number of operations needed for Mirko to write the given data into his memory module. Initially, all bits in the memory module are zero.
입력
The first line of input contains an integer R (1 ≤ R ≤ 50), the number of rows in the module.
Each of the following R rows contains a string of 16 digits '0' or '1', data to be written into the module.
출력
Output the smallest number of operations.
예제
예제 1
5 0000111111110000 0010000000000000 1101111111111111 0010000000000000 0000000000000000
3
예제 2
4 0000001000000010 0000110111000011 0111001000001111 0000001000000011
6