Do you know Jack-Jack? He is the youngest child of Parr family. The Parr family consists of Bob, Helen, Violet, Dashiell, and Jack-Jack. They are all characters of the “The Incredibles Movie”. Jack-Jack has many superpowers. Some of them are still not discovered yet. Recently, Helen saw Jack-Jack playing with matrices.
Jack-Jack thinks each cell of a matrix is powerful if it has three neighbors, which sum of their values is a power of two. Two cells are neighbors if and only if they share a side or corner. Jack-Jack is superhero, he is not a programmer. Can you count the number of powerful cells of the matrix for him?
The first line of input contains two space separated integers , – the number of rows and the number of columns of the matrix.
In each of the next lines, there are space-separated integers each representing a cell of the matrix. The value each cell is a non-negative integer that does not exceed .
For each test, print a single integer, the number of powerful cells in the matrix.