#include <bits/stdc++.h>
using namespace std;
int n, m;
char v[550][550];
int memo[505][505][10];
bool calcula(int x, int y, int tam, int ind, int mask) {
  int mx = (x + tam / 2);
  int my = (y + tam / 2);
  if (mask & (1 << 0)) {
    if (memo[x][y][ind - 1] != 15) return false;
  } else {
    if (memo[x][y][ind - 1] != mask) return false;
  }
  if (mask & (1 << 1)) {
    if (memo[x][my][ind - 1] != 15) return false;
  } else {
    if (memo[x][my][ind - 1] != mask) return false;
  }
  if (mask & (1 << 2)) {
    if (memo[mx][y][ind - 1] != 15) return false;
  } else {
    if (memo[mx][y][ind - 1] != mask) return false;
  }
  if (mask & (1 << 3)) {
    if (memo[mx][my][ind - 1] != 15) return false;
  } else {
    if (memo[mx][my][ind - 1] != mask) return false;
  }
  return true;
}
int main() {
  scanf("%d %d ", &n, &m);
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (m); j++) {
      char c;
      scanf("%c ", &v[i][j]);
    }
  }
  int res = 0;
  for (int i = 0; i <= n - 2; i++) {
    for (int j = 0; j <= m - 2; j++) {
      memo[i][j][0] = 0;
      if (v[i][j] == '*') {
        memo[i][j][0] |= (1 << 0);
      }
      if (v[i][j + 1] == '*') {
        memo[i][j][0] |= (1 << 1);
      }
      if (v[i + 1][j] == '*') {
        memo[i][j][0] |= (1 << 2);
      }
      if (v[i + 1][j + 1] == '*') {
        memo[i][j][0] |= (1 << 3);
      }
    }
  }
  int k = 1;
  for (int x = 4; x <= min(n, m); x = x * 2) {
    for (int i = 0; i <= n - x; i++) {
      for (int j = 0; j <= m - x; j++) {
        memo[i][j][k] = -1;
        for (int mask = 0; mask < (16); mask++) {
          if (calcula(i, j, x, k, mask)) {
            memo[i][j][k] = mask;
            res++;
            break;
          }
        }
      }
    }
    k++;
  }
  printf("%d\n", res);
  return 0;
}
