#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
#include <cstring>

//ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1e9 + 7;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

int cans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


int main() {
    int H,W;
    cin >> H >> W;
    char S[H][W];
    rep(i,H) {
	rep(j,W) {
	    cin >> S[i][j];
	}
    }
    int ans = 0;
    rep(i,H-1) {
	rep(j,W-1) {
	    int num = 0;
	    if(S[i][j] == '#') num++;
	    if(S[i][j+1] == '#') num++;
	    if(S[i+1][j] == '#') num++;
	    if(S[i+1][j+1] == '#') num++;

	    if(num == 1 || num == 3) ans++;
	}
    }
    cout << ans << endl;
    
    return 0;

}
	 
	




#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

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 (a>b) { a=b; return 1; } return 0; }

bool check(vector<char> v){
	int cnt = count(v.begin(),v.end(), '.');
	return cnt % 2 == 1;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int h, w;
	cin >> h >> w;

	vector<string> b(h);
	rep(i, h) cin >> b[i];

	int ans = 0;
	rep(i, h-1) rep(j, w-1){
		if(check({b[i][j], b[i][j+1], b[i+1][j], b[i+1][j+1]})) ans++;
	}

	cout << ans << endl;
}
