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

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int HH = 620;
		int WW = 620;
		int ofs = 310;
		
		int[][] m = new int[HH][];
		for(int i=0;i<HH;i++){
			m[i] = new int[WW];
		}
		
		var h = new HashSet<int>();
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if(S[i][j] == '#'){
					int x = (j + i);
					int y = (j - i) + ofs;
					m[y][x] = 1;
					h.Add(y * WW + x);
				}
			}
		}
		
		var ac = new Acc2();
		ac.Init(m);
		
		long cv = 0;
		foreach(var yx in h){
			int y = yx / WW;
			int x = yx % WW;
			for(int i=2;x + i<WW;i++){
				if(!h.Contains(y * WW + (x + i))) continue;
				if(y + i <HH){
					cv += ac.Sum(x + 1, y + i, x + i, y + i + 1);
				}
				if(y - i >= 0){
					cv += ac.Sum(x + 1, y - i, x + i, y - i + 1);
				}
			}
			for(int i=2;y + i<HH;i++){
				if(!h.Contains((y + i) * WW + x)) continue;
				if(x + i <WW){
					cv += ac.Sum(x + i, y + 1, x + i + 1, y + i);
				}
				if(x - i >= 0){
					cv += ac.Sum(x - i, y + 1, x - i + 1, y + i);
				}
			}
			//Console.WriteLine("y:{0} x:{1}",y,x);
			int x1,x2,y1,y2;
			for(int i=1;i<HH;i++){
				x1 = x + i; y1 = y + 0; x2 = x + 0; y2 = y + i;
				if(InRange(x1,0,WW) && InRange(x2,0,WW) && InRange(y1,0,HH) && InRange(y2,0,HH) && h.Contains(y1 * WW+ x1) && h.Contains(y2 * WW + x1)) cv++;
				x1 = x + i; y1 = y + 0; x2 = x + 0; y2 = y - i;
				if(InRange(x1,0,WW) && InRange(x2,0,WW) && InRange(y1,0,HH) && InRange(y2,0,HH) && h.Contains(y1 * WW+ x1) && h.Contains(y2 * WW + x1)) cv++;
				x1 = x - i; y1 = y + 0; x2 = x + 0; y2 = y + i;
				if(InRange(x1,0,WW) && InRange(x2,0,WW) && InRange(y1,0,HH) && InRange(y2,0,HH) && h.Contains(y1 * WW+ x1) && h.Contains(y2 * WW + x1)) cv++;
				x1 = x - i; y1 = y + 0; x2 = x + 0; y2 = y - i;
				if(InRange(x1,0,WW) && InRange(x2,0,WW) && InRange(y1,0,HH) && InRange(y2,0,HH) && h.Contains(y1 * WW+ x1) && h.Contains(y2 * WW + x1)) cv++;
			}
		}
		
		Console.WriteLine(cv);
		
		
	}
	
	bool InRange(int t, int l, int r){
		return l <= t && t < r;
	}
	int H,W;
	String[] S;
	public Sol(){
		var d = ria();
		H = d[0]; W = d[1];
		S = new String[H];
		for(int i=0;i<H;i++){
			S[i] = rs();
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


class Acc2{
	public int H,W;
	public int[][] acc;
	public int Sum(int x1,int y1,int x2,int y2){
		//return num of land [x1,x2)*[y1,y2); left-inclusive / right-noninclusive;
		if(x2 < x1 || y2 < y1) return 0;
		return acc[y2][x2] - acc[y2][x1] - acc[y1][x2] + acc[y1][x1];
	}
	public void Init(int[][] M){
		H = M.Length;
		W = M[0].Length;
		acc = new int[H+1][];
		for(int i=0;i<=H;i++){
			acc[i] = new int[W+1];
			if(i == 0) continue;
			for(int j=1;j<=W;j++){
				acc[i][j] = M[i-1][j-1];
			}
		}
		
		for(int i=1;i<=H;i++){
			for(int j=1;j<=W;j++){
				acc[i][j] += acc[i][j-1];
			}
		}
		for(int j=1;j<=W;j++){
			for(int i=1;i<=H;i++){
				acc[i][j] += acc[i-1][j];
			}
		}
	}
}