You have unexpectedly become the owner of a large chessboard, fifteen squares on each side. Because you do not know how to play chess on such a large board, you decide to make use of it another way.
In chess, a rook attacks every square in the same row or the same column as itself. For this problem, a rook also attacks the square it stands on. A rook may be placed on any square of the board.
Given a set of marked squares, how many rooks are needed to attack all of them?
Input consists of a number of test cases. Each test case consists of fifteen lines, each containing fifteen characters describing the board. Each character is either a period (.) or a hash (#). Every square marked with a hash must be attacked by a rook. After all the test cases, one more line appears, containing the word END.
Output exactly one line per test case, containing a single integer: the minimum number of rooks that must be placed on the board so that every hash-marked square is attacked.