#include <bits/stdc++.h>
using namespace std;
const int N = 550;
int n, m;
char a[6][6] = {"0.***", "0.***", "0.***", "0.***", "0.***"};
char b[6][6] = {"0....", "0.***", "0..**", "0.*.*", "0...."};
char c[6][6] = {"0***.", "0.***", "0*.**", "0**.*", "0***."};
char d[6][6] = {"0....", "0....", "0....", "0....", "0...."};
char mp[N][N];
bool dp[N][N][1 << 4][10];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= int(n); i++) scanf("%s", mp[i] + 1);
  for (int i = 1; i <= int(n); i++)
    for (int j = 1; j <= int(m); j++) {
      dp[i][j][(1 << 4) - 1][0] = (mp[i][j] == '*');
      for (int mask = 0; mask < (1 << 4) - 1; mask++)
        dp[i][j][mask][0] = (mp[i][j] == '.');
    }
  for (int k = 1; k <= int(9); k++)
    for (int mask = 0; mask < (1 << 4); mask++) {
      int d = (1 << (k - 1));
      for (int x = 1; x <= int(n); x++)
        for (int y = 1; y <= int(m); y++) {
          int nx[4] = {x, x, x + d, x + d}, ny[4] = {y, y + d, y, y + d};
          bool flag = 1;
          for (int p = 0; p <= 3; p++) {
            int xx = nx[p], yy = ny[p];
            if (xx > n || yy > m) {
              flag = 0;
              continue;
            }
            if (mask & (1 << p))
              flag &= dp[xx][yy][(1 << 4) - 1][k - 1];
            else
              flag &= dp[xx][yy][mask][k - 1];
          }
          dp[x][y][mask][k] = flag;
        }
    }
  int ans = 0;
  for (int x = 1; x <= int(n); x++)
    for (int y = 1; y <= int(m); y++)
      for (int mask = 0; mask < (1 << 4); mask++)
        for (int k = 2; k <= 9; k++) ans += dp[x][y][mask][k];
  cout << ans << endl;
}
