///Astalavista Code........~sachinait
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define Br cout<<endl
#define int long long
#define pb push_back
#define mp make_pair
#define double long double
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define PT(x) cout << (x) << endl
#define PTT(x) cout << (#x) << " is " << (x) << endl; 
#define debug(x) cout<<"~~"<<#x<<" => "<<x<<endl; 
#define lets_go ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
const int M = 1e9 + 7;
const int N = 2e6 + 10;
const int IM = 1e15 + 37;
const double PI = 3.1415926535897932384;
inline void PP(int n) { cout << n << " ";}
void IN(vector<int>&arr,int n,int x=0){for(int i=x;i<n+x;i++)cin>>arr[i];}
void PV(vi v) { for (int i = 0 ; i < v.size() ; i++) cout << v[i] << " " ; cout << endl;}
void PVR(vi v) { for (int i = v.size()-1 ; i >=0 ; i--) cout << v[i] << " " ; cout << endl;}
void PVV(vii v) {for (int i = 0 ; i < v.size() ; i++) cout << v[i].first << " " << v[i].second << endl;}
void PA(int v[], int n, int x = 0) { for (int i = x ; i < n + x; i++)cout << v[i] << " " ; cout << endl;}
void IN(int a[], int n, int x = 0) {for (int i = x; i < n + x; i++)cin >> a[i];}
// <=================================================================================================================================
// <=================================================================================================================================


void fun(){
    int h,w;cin>>h>>w;
    vector<string>a(h);
    for(int i=0;i<h;i++)
    {
        cin>>a[i];
    }
    int ans=0;
    for(int i=0;i<h;i++)
    {
        for(int j=0;j<w;j++)
        {
            if(j+1<w && a[i][j]=='.' && a[i][j+1]=='.')
            {
                ans++;
            }
            if(i+1<h && a[i][j]=='.' && a[i+1][j]=='.')
            {
                ans++;
            }
        }
    }
    cout<<ans;
}

signed  main() {
    lets_go

    int t;
    t=1;
    // cin >> t;
    while (t--) {            
         fun();             
    }                        
                            
                            
    return 0;

}

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int maxm = 20 + 10;
int n, m, ans;
char s[maxm];
int a[2];
int main()
{
	cin >> n >> m;
	for(int i = 1; i <= n; ++i)
	{
		scanf("%s", s);
		int ret = 0;
		for(int j = 0; j < m; ++j)
			ret = (ret << 1) + s[j] - '0';
		++a[__builtin_popcount(ret) & 1];
	}
	printf("%lld\n", 1ll * a[0] * a[1]);
	return 0;
}
	 
		
	
	