#include <bits/stdc++.h>
using namespace std;
char mp[555][555];
bool a[10][555][555][16];
int d[4][2];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", mp[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (mp[i][j] == '*') {
        a[0][i][j][15] = 1;
      } else {
        for (int k = 0; k < 15; k++) a[0][i][j][k] = 1;
      }
  int len = 2;
  int ans = 0;
  int tp = 0;
  while (1) {
    if (len > n || len > m) break;
    ++tp;
    for (int i = 0; i + len <= n; i++)
      for (int j = 0; j + len <= m; j++) {
        d[0][0] = i;
        d[0][1] = j;
        d[1][0] = i + len / 2;
        d[1][1] = j;
        d[2][0] = i;
        d[2][1] = j + len / 2;
        d[3][0] = i + len / 2;
        d[3][1] = j + len / 2;
        for (int k = 0; k < 16; k++) {
          for (int j = 0; j < 4; j++)
            if ((1 << j) & k) {
              if (a[tp - 1][d[j][0]][d[j][1]][15] == 0) goto st;
            } else if (a[tp - 1][d[j][0]][d[j][1]][k] == 0)
              goto st;
          a[tp][i][j][k] = 1;
          if (len > 2) ans++;
        st:;
        }
      }
    len = len * 2;
  }
  printf("%d\n", ans);
}
