import java.util.*;
import java.io.*;



public class Main {

     static PrintWriter p;
     static char [][] scheme;
     static int n;
     static int m;
     public static void main(String[] args) throws Exception{
        Scanner s= new Scanner(new File("floor.in"));
         p = new PrintWriter(new File("floor.out"));
         String st="";
         n = s.nextInt();
         m = s.nextInt();
         scheme = new char[n][m];
         s.nextLine();
         int ans = 0;

         for(int i = 0; i < n; i++){
             st = s.nextLine();
             for (int j = 0; j < m; j++){
                 scheme[i][j] = st.charAt(j);
             }
         }

         char doska='-';
         for(int i = 0; i < n; i++){
             doska='|';
             for(int j = 0; j < m; j++){
                 if(scheme[i][j] == '-'){
                     if(scheme[i][j]!=doska) ans++;
                 }
             doska = scheme[i][j];
             }
         }


         for(int j = 0; j < m; j++){
             doska = '-';
             for(int i = 0; i < n; i++){
                 if(scheme[i][j] == '|'){
                     if(scheme[i][j]!=doska) ans++;
                 }
             doska = scheme[i][j];
             }
         }


         p.print(ans);
         p.close();


}


}


