Problem: Little Vasya likes painting fractals very much.

He does it like this. First the boy cuts out a 2 × 2-cell square out of squared paper. Then he paints some cells black. The boy calls the cut out square a fractal pattern. Then he takes a clean square sheet of paper and paints a fractal by the following algorithm:

  1. He divides the sheet into four identical squares. A part of them is painted black according to the fractal pattern. 
  2. Each square that remained white, is split into 4 lesser white squares, some of them are painted according to the fractal pattern. Each square that remained black, is split into 4 lesser black squares. 



In each of the following steps step 2 repeats. To draw a fractal, the boy can make an arbitrary positive number of steps of the algorithm. But he need to make at least two steps. In other words step 2 of the algorithm must be done at least once. The resulting picture (the square with painted cells) will be a fractal. The figure below shows drawing a fractal (here boy made three steps of the algorithm).

<image>

One evening Vasya got very tired, so he didn't paint the fractal, he just took a sheet of paper, painted a n × m-cell field. Then Vasya paint some cells black. 

Now he wonders, how many squares are on the field, such that there is a fractal, which can be obtained as described above, and which is equal to that square. Square is considered equal to some fractal if they consist of the same amount of elementary not divided cells and for each elementary cell of the square corresponding elementary cell of the fractal have the same color.

Input

The first line contains two space-separated integers n, m (2 ≤ n, m ≤ 500) — the number of rows and columns of the field, correspondingly. 

Next n lines contain m characters each — the description of the field, painted by Vasya. Character "." represents a white cell, character "*" represents a black cell.

It is guaranteed that the field description doesn't contain other characters than "." and "*".

Output

On a single line print a single integer — the number of squares on the field, such that these squares contain a drawn fractal, which can be obtained as described above.

Examples

Input

6 11
......*.***
*.*.*....**
.***....*.*
..***.*....
.*.*.....**
......*.*..


Output

3


Input

4 4
..**
..**
....
....


Output

0

Note

The answer for the first sample is shown on the picture below. Fractals are outlined by red, blue and green squares.

<image>

The answer for the second sample is 0. There is no fractal, equal to the given picture.

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
char onechar() {
  static const int BUFSIZE = 1 << 20;
  static char buf[BUFSIZE], *ptr = buf + BUFSIZE;
  if (ptr == buf + BUFSIZE) fread(ptr = buf, 1, BUFSIZE, stdin);
  return *ptr++;
}
char nextchar() {
  char c;
  while (isspace(c = onechar()))
    ;
  return c;
}
int nextint() {
  char c;
  while (!isdigit(c = onechar()))
    ;
  int ans = c - '0';
  while (isdigit(c = onechar())) ans = ans * 10 + c - '0';
  return ans;
}
string nextstring() {
  char c;
  string ret;
  while (!isspace(c = onechar())) ret += c;
  return ret;
}
template <typename T>
vector<T> &operator+=(vector<T> &v, const T &e) {
  v.push_back(e);
  return v;
}
template <typename T>
string tobin(T n) {
  string ret;
  do ret = char('0' + (n & 1)) + ret;
  while (n /= 2);
  return ret;
}
inline unsigned int nextbitperm(unsigned int mask) {
  unsigned int ile = __builtin_ctz(mask), t = ~(mask >> ile),
               q = __builtin_ctz(t);
  return ~(((((((t >> q) - 1) << 1) + 1) << ile) | ((1 << (ile)) - 1))
           << (q - 1));
}
short pyramid[10][1024][1024];
short code(short a, short b, short c, short d, bool exact) {
  short tab[4];
  tab[0] = a;
  tab[1] = b;
  tab[2] = c;
  tab[3] = d;
  short should = (a == 15) + (b == 15) * 2 + (c == 15) * 4 + (d == 15) * 8;
  for (int i = 0; i < 4; i++) {
    if (tab[i] == -1 || (tab[i] != 15 && tab[i] != should * exact)) return -1;
  }
  return should;
}
int main(int argc, char **argv) {
  for (int lev = 0; lev < 10; lev++)
    for (int i = 0; i < 1024; i++)
      for (int j = 0; j < 1024; j++) pyramid[lev][i][j] = -1;
  int counter = 0;
  int R, C;
  scanf("%d %d", &R, &C);
  for (int i = 0; i < R; i++) {
    char buf[1000];
    scanf("%s", buf);
    for (int j = 0; j < C; j++) pyramid[0][i][j] = buf[j] == '.' ? 0 : 15;
    pyramid[0][i][C] = -1;
  }
  for (int lev = 1; lev < 10; lev++) {
    int shift = 1 << (lev - 1);
    for (int r = 0; r < R; r++)
      for (int c = 0; c < C; c++) {
        short tmp = code(pyramid[lev - 1][r][c], pyramid[lev - 1][r][c + shift],
                         pyramid[lev - 1][r + shift][c],
                         pyramid[lev - 1][r + shift][c + shift], lev != 1);
        if (tmp != -1 && lev >= 2) counter++;
        pyramid[lev][r][c] = tmp;
      }
  }
  for (int lev = 0; lev <= 4; lev++) {
    for (int r = 0; r < R; r++) {
      for (int c = 0; c < C; c++)
        fprintf(stderr, "%3d ", (int)pyramid[lev][r][c]);
      fprintf(stderr, "\n");
    }
    fprintf(stderr, "---------------------\n");
  }
  printf("%d\n", counter);
  return 0;
}