#include<bits/stdc++.h>

using namespace std;

int ans = 0;
int H,W;
char field[100][100];

void cal(int x, int y){

    //上
    if(x >= 0 && y-1>=0 && x<W && y-1<H){
        if(field[y-1][x] == '.'){
            ans++;
        }
    }

    //右
    if(x+1 >= 0 && y>=0 && x+1<W && y<H){
        if(field[y][x+1] == '.'){
            ans++;
        }
    }

    //左
    if(x-1 >= 0 && y>=0 && x-1<W && y<H){
        if(field[y][x-1] == '.'){
            ans++;
        }
    }

    //下
    if(x >= 0 && y+1>=0 && x<W && y+1<H){
        if(field[y+1][x] == '.'){
            ans++;
        }
    }

}

int main(){

    cin >> H >> W;
    
    for(int i = 0;i<H;i++){
        for(int j = 0;j<W;j++){
            cin >> field[i][j];
        }
    }

    for(int i = 0;i<H;i++){
        for(int j = 0;j<W;j++){
            if(field[i][j] == '.'){
                field[i][j] = '#';
                cal(j,i);
            }
        }
    }

    cout << ans << endl;

    return 0;
}
#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#define ordered_set tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
using namespace std;
using namespace __gnu_pbds;
//#define int long long int
#define pb push_back
#define vec vector<int>
#define fo(i, n) for (int i = 0; i < n; i++)
#define foo(i, a, b) for (int i = a; i < b; i++)
#define mp make_pair

#define mod 1000000007
//#define mod 998244353
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second
void __print(int x)
{
    cerr << x;
}
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }

template <typename T, typename V>
void __print(const pair<T, V> &x)
{
    cerr << '{';
    __print(x.first);
    cerr << ',';
    __print(x.second);
    cerr << '}';
}
template <typename T>
void __print(const T &x)
{
    int f = 0;
    cerr << '{';
    for (auto &i : x)
        cerr << (f++ ? "," : ""), __print(i);
    cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v)
{
    __print(t);
    if (sizeof...(v))
        cerr << ", ";
    _print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...)               \
    cerr << "[" << #x << "] = ["; \
    _print(x)
#else
#define debug(x...)
#endif

int power(int x, unsigned int y, int p)
{
    int res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
int mI(int a, int m)
{
    return power(a, m - 2, m);
}
//__builtin_popcount
vector<vector<int>>
    dir = {{0, 1}, {1, 0}, {1, 0}, {-1, 0}, {1, 1}, {1, -1}, {-1, 1}, {-1, -1}};

#define double long double

void solve()
{
    int n, m;
    cin >> n >> m;
    vector<string> v(n);
    int ans = 0;
    fo(i,n){
        cin >> v[i];
    }
    fo(i,n){
        fo(j,m){
            fo(k,2){
                int i1 = i + dir[k][0];
                int j1 = j + dir[k][1];
                if(i1>=0&&i1<n&&j1>=0&&j1<m&&v[i][j]=='.'&&v[i1][j1]=='.'){
                    ans++;
                }
            }
        }
    }
    cout << ans << "\n";
}

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    srand(time(0));

    // FILE *fin = freopen("ip.txt","r",stdin);
    // FILE *fout = freopen("op.txt","w",stdout);

    int t = 1, nn = 1;
    //cin >> t;
    while (t--)
    {
        // cout << "Case #" << nn << ":"
        //      << " ";
        // nn++;

        solve();
    }
}