#ifdef __LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using PIL = pair<int,ll>;
using PLI = pair<ll,int>;
using PLL = pair<ll,ll>;
using Graph = vector<vector<int>>;
using Cost_Graph = vector<vector<PIL>>;

template<class T> bool chmin(T &a, T b) {if(a>b){a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b){a=b;return 1;}return 0;}
#define rep(i,n) for(int i=0;i<int(n);i++)
#define roundup(a,b) (a+b-1)/b
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;
const double pi = 3.14159265358979;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    int h,w;
    cin >> h >> w;
    vector<vector<char>> table(h, vector<char>(w));
    for (int i = 0;i < h;i++){
        for (int j = 0;j < w;j++){
            cin >> table[i][j];
        }
    }

    int ans = 0;
    for (int i = 0; i < h-1; i++){
        for (int j = 0; j < w-1; j++){
            int counter = 0;
            if (table[i][j] == '#') counter++;
            if (table[i+1][j] == '#') counter++;
            if (table[i][j+1] == '#') counter++;
            if (table[i+1][j+1] == '#') counter++;

            if (counter == 1 || counter == 3) ans++;
        }
    }

    cout << ans << endl;
}
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
#include<stdio.h>
#include<string.h>
const double pi=acos(-1.0);
using namespace std;
//using namespace __gnu_pbds;
#define   endl    '\n'
#define   sl(n)     scanf("%lld",&n)
#define   mp      make_pair
#define   pb      push_back
#define   ppb     pop_back
#define   fi      first
#define   se      second
#define   ll      long long
#define   ull     unsigned long long
#define   ld      long double
#define   pii     pair<int, int>
#define   f(i,a,b)  for(ll i = (ll)(a); i < (ll)(b); i++)
#define   rf(i,a,b)   for(ll i = (ll)(a); i > (ll)(b); i--)
#define   ms(a,b)   memset((a),(b),sizeof(a))
#define   abs(x)    ((x<0)?(-(x)):(x))
#define   MAX     1000005
#define   inf     LLONG_MAX
#define   ninf    LLONG_MIN
#define   MIN     INT_MIN
#define   yeet    return 0;
#define tihs if(fopen("input.txt","r"))freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);

#define fast_io ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long  b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}

//typedef
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
 
 
int mod = 1e9 +7 ;
int64_t extGcd(int64_t a, int64_t b, int64_t& x, int64_t& y) {if (!a) {x = 0;y = 1;return b;}int64_t x1, y1;int64_t d = extGcd(b % a, a, x1, y1);x = y1 - (b / a) * x1;y = x1;return d;}
inline ll addmod(ll a,ll b){a=a%mod+b%mod;if(a>mod)a%=mod;return a;}
inline ll submod(ll a,ll b){a=a%mod-b%mod;if(a<0)a+=mod;return a;}
inline ll mulmod(ll a,ll b){return (a%mod * b%mod)%mod;}

int dx[]={1,1,0,-1,-1,-1, 0, 1};
int dy[]={0,1,1, 1, 0,-1,-1,-1};
inline ll exp(ll a,ll b){if(a==0)return 0ll;ll r=1LL;while(b>0){if(b&1){r=r*(a%mod);r=(r+mod)%mod;}b/=2;a=(a%mod)*(a%mod);a=(a+mod)%mod;}return (r+mod)%mod;}
ll gcd(ll a,ll b){if(b==0)return a;if(a==0)return b;return gcd(b,a%b);}
uint32 setbits(ll n){uint32 count=0;while (n){n&=(n-1);count++;}return count; }

////****************************************************************************************************************************************************************************************************************////


int main(){
    int h,w;
	cin>>h>>w;
	vector<string> s(h);
	
	f(i,0,h){
	    cin>>s.at(i);
	}
int ans=0;
	f(i,0,h-1){
	f(j,0,w-1){
	    if(s.at(i).at(j)=='#'&&s.at(i+1).at(j)=='.'&&s.at(i).at(j+1)=='.'&&s.at(i+1).at(j+1)=='.'){
	        ans++;
	    }
	    if(s.at(i).at(j)=='.'&&s.at(i+1).at(j)=='#'&&s.at(i).at(j+1)=='.'&&s.at(i+1).at(j+1)=='.'){
	        ans++;
	    }
	    if(s.at(i).at(j)=='.'&&s.at(i+1).at(j)=='.'&&s.at(i).at(j+1)=='#'&&s.at(i+1).at(j+1)=='.'){
	        ans++;
	    }
	    if(s.at(i).at(j)=='.'&&s.at(i+1).at(j)=='.'&&s.at(i).at(j+1)=='.'&&s.at(i+1).at(j+1)=='#'){
	        ans++;
	    }
	    if(s.at(i).at(j)=='.'&&s.at(i+1).at(j)=='#'&&s.at(i).at(j+1)=='#'&&s.at(i+1).at(j+1)=='#'){
	        ans++;
	    }
	    	    if(s.at(i).at(j)=='#'&&s.at(i+1).at(j)=='.'&&s.at(i).at(j+1)=='#'&&s.at(i+1).at(j+1)=='#'){
	        ans++;
	    }
	    	    if(s.at(i).at(j)=='#'&&s.at(i+1).at(j)=='#'&&s.at(i).at(j+1)=='.'&&s.at(i+1).at(j+1)=='#'){
	        ans++;
	    }
	    	    if(s.at(i).at(j)=='#'&&s.at(i+1).at(j)=='#'&&s.at(i).at(j+1)=='#'&&s.at(i+1).at(j+1)=='.'){
	        ans++;
	    }
	}
	}
cout<<ans;
	return 0;
}
