#include <bits/stdc++.h>
using namespace std;
const int K = 20;
const int N = 510;
const int P = 100;
const int B = 11;
const int M = 1000000007;
int n, m;
char s[N][N], dp[N][N][16][16];
int dx[] = {0, 0, 1, 1};
int dy[] = {0, 1, 0, 1};
int _dp(int x, int y, int stp, int mask) {
  if (stp == 0) {
    if (mask != 15)
      return s[x][y] == '.';
    else
      return s[x][y] == '*';
  }
  char &t = dp[x][y][stp][mask];
  if (t) return t;
  for (int i = 0; i < 4; ++i)
    if ((mask >> i) & 1) {
      if (~_dp(x + (dx[i] << (stp - 1)), y + (dy[i] << (stp - 1)), stp - 1,
               15) &
          1)
        return t = 2;
    } else {
      if (~_dp(x + (dx[i] << (stp - 1)), y + (dy[i] << (stp - 1)), stp - 1,
               mask) &
          1)
        return t = 2;
    }
  return t = 1;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> (s[i] + 1);
  int ans = 0;
  for (int s = 2; (1 << s) <= n && (1 << s) <= m; ++s)
    for (int i = 1; i <= n - (1 << s) + 1; ++i)
      for (int j = 1; j <= m - (1 << s) + 1; ++j)
        for (int k = 0; k < 16; ++k)
          if (_dp(i, j, s, k) & 1) ans++;
  cout << ans << '\n';
}
