using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _3.pozar
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int m = int.Parse(s[1]);
            char[,] a=new char[n,m];
            bool vatra = false;
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < m; j++)
                {
                    a[i, j] = (char)Console.Read();
                    if (a[i, j] == 'X') vatra = true;
                }
                Console.ReadLine();
            }
            if (!vatra) Console.WriteLine(n * m);
        }
    }
}