    #include<bits/stdc++.h>
    using namespace std;
    #define A(x) (x).begin(),(x).end()
    #define sz(x) ((int)(x).size())
    #define long long long
    void _read();
    char grid[101][101]; 

    const int dx[] = {1,-1,0,0};
    const int dy[] = {0,0,1,-1};



    int _count( int h, int w) {
          long cnt = 0;
          for ( int i = 0; i < h; i++) {
                for( int j = 0; j < w; j++) {
                      if(grid[i][j] == '#') continue;
                      for( int d = 0; d < 4; ++d) {
                            int x = i+dx[d], y = j+dy[d];
                            if( x < 0 or y < 0 or x > h-1 or y > w-1 ) continue;
                            if(grid[x][y] == '#') continue;
                            cnt++;
                      }
                }
          }
          return (cnt >> 1);
    }
     
    int main () { _read(); 
     
          int h,w;
          cin >> h >> w;
          for( int i = 0; i < h; i++) {
                for( int j = 0; j < w; j++) {
                      cin >> grid[i][j];
                }
          }
          cout << _count(h,w) << "\n";
          return 0;
    };
     
    void _read() {
          ios_base :: sync_with_stdio(false);
          cin.tie(NULL);
          #ifdef LOCAL
          freopen("input.txt","r",stdin);
          #endif
    }
#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REP_REV(i,a,b) for (int i = a; i >= b; i--)
#define what_is(x) cerr << #x << " is " << x << endl;
#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<ll> vl;
typedef pair<ll, ll> pl;
typedef map<string, ll> msl;

ll MOD = 1e9 + 7;

struct Rect {
	ll x1 = 0, y1 = 0, x2 = 0, y2 = 0;
	ll area() { return (x2 - x1) * (y2 - y1); }
};

Rect intersect(Rect p, Rect q) {
	Rect inter;
	inter.x1 = max(p.x1, q.x1);
	inter.y1 = max(p.y1, q.y1);
	inter.x2 = min(p.x2, q.x2);
	inter.y2 = min(p.y2, q.y2);
	if (inter.x1 >= inter.x2 || inter.y1 >= inter.y2) {
		Rect empty;
		return empty;
	}
	return inter;
}

bool iscovered(int x, int y, int x1, int y1, int x2, int y2) {
	return (x <= x2 && x >= x1 && y <= y2 && y >= y1);
}

bool allzero(vi a) {
	REP(i, 0, (int) a.size() - 1) {
		if (a[i] != 0) return false;
	}
	return true;
}

int isvalidTriange(int x1, int y1, int x2, int y2, int x3, int y3) {
	int height, width;
	if (x1 == x2) height = abs(y1 - y2);
	 else if (x1 == x3) height = abs(y1 - y3);
	 else if (x2 == x3) height = abs(y2 - y3);
	 else height = 0;

	 if (y1 == y2) width = abs(x1 - x2);
	 else if (y1 == y3) width = abs(x1 - x3);
	 else if (y2 == y3) width = abs(x2 - x3);
	 else width = 0;

	 return(height*width);
}

void solve() {
	/*int n; 
	cin >> n;

	vector<pair<int, int>> pts;
	REP(i, 0, n - 1) {
		int x, y;
		cin >> x >> y;
		pair<int, int> p = make_pair(x, y);
		pts.PB(p);
	}

	int area = 0;

	REP(i, 0, n - 1){
		REP(j, i + 1, n - 1) {
			REP(k, j + 1, n - 1 ) {
				area = max(area, isvalidTriange(pts[i].F, pts[i].S, pts[j].F, pts[j].S, pts[k].F, pts[k].S));
			}
		}
	}

	cout << area;*/
	int h, w;
	cin >> h >> w;
	char grid[h][w];
	REP(i, 0, h - 1) {
		REP(j, 0, w - 1) {
			cin >> grid[i][j];
		}
	}
	int poss = 0;
	REP(i, 0, h - 1) {
		REP(j, 0, w - 1) {
			if (i != (h - 1)) if (grid[i][j] == '.' && grid[i + 1][j] == '.') poss++;
			if (i != 0) if (grid[i][j] == '.' && grid[i - 1][j] == '.') poss++;
			if (j != w - 1) if (grid[i][j] == '.' && grid[i][j  + 1] == '.') poss++;
			if (j != 0) if (grid[i][j] == '.' && grid[i][j - 1] == '.') poss++;
		}
	}

	cout << poss/2;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	//freopen("triangles.in", "r", stdin);
	//freopen("triangles.out", "w", stdout);
	//ll t; cin >> t;
	//while (t--)
	solve();
	return 0;
}
