#include<bits/stdc++.h>
using namespace std;
int n,m,ans=0;
bool dt[20][20];
char str[20];
inline int read()
{
	int x=0,w=0;char ch=0;
	while(!isdigit(ch)){w|=ch=='-';ch=getchar();}
	while(isdigit(ch)){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
	return w?-x:x;
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		scanf("%s",str+1);
		for(int j=1;j<=m;j++)
		dt[i][j]=(str[j]=='#');
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if((dt[i-1][j]==0||dt[i-1][j-1]==1)&&(dt[i][j]==1&&dt[i][j-1]==0))ans++;
			if((dt[i-1][j]==0||dt[i-1][j+1]==1)&&(dt[i][j]==1&&dt[i][j+1]==0))ans++;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if((dt[i][j-1]==0||dt[i-1][j-1]==1)&&(dt[i][j]==1&&dt[i-1][j]==0))ans++;
			if((dt[i][j-1]==0||dt[i+1][j-1]==1)&&(dt[i][j]==1&&dt[i+1][j]==0))ans++;
		}
	}
	cout<<ans<<'\n';
	
}
//#include<bits/stdc++.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string>
#include<vector>
#define swap(x,y) (y -= (x = ((y += x) - x)))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define reps(i,n) for(int i = 1, i <= (int)(n); i++)
#define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--)
#define rreps(i,n) for(int i = (int)(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
using ll = long long;
using namespace std;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
int digit(ll n, int a) { int s = 0;	for (int i = 0; n > 0; i++) { s++;	n /= a; }	return s; }
int imax(int a[], int n) { int s = a[0];	rep(i, n) { s = max(s, a[i]); }	return s; }
int imin(int a[], int n) { int s = a[0];	rep(i, n) { s = min(s, a[i]); }	return s; }
int cmax(string a, int n) { int s = 0;	rep(i, n) { s = max(s, (int)a[i] - '0'); }	return s; }
int cmin(string a, int n) { int s = 9;	rep(i, n) { s = min(s, (int)a[i] - '0'); }	return s; }

//quick sort(int)
int ascfunc(const void* n1, const void* n2) {
	if (*(int*)n1 > *(int*)n2) {
		return 1;
	}
	if (*(int*)n1 < *(int*)n2) {
		return -1;
	}
	if (*(int*)n1 == *(int*)n2) {
		return 0;
	}
}

int main(void) {
	int h, w;	cin >> h >> w;
	string* s = new string[h];
	rep(i, h) {
		cin >> s[i];
	}

	int ans = 0;
	rep(i, h) {
		rep(j, w) {
			if (i < h - 1 && j < w - 1) {
				int bn = 0;
				rep(k, 2) {
					rep(l, 2) {
						if (s[i + k][j + l] == '#') {
							bn++;
						}
					}
				}
				if (bn == 1 || bn == 3) {
					ans++;
				}
			}
		}
	}

	cout << ans << endl;
	return 0;
}