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>();
		List<int>[] Ver = new List<int>[WW];
		for(int i=0;i<WW;i++) Ver[i] = new List<int>();
		List<int>[] Hor = new List<int>[HH];
		for(int i=0;i<HH;i++) Hor[i] = new List<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);
					Ver[x].Add(y);
					Hor[y].Add(x);
				}
			}
		}
		
		for(int i=0;i<HH;i++) Hor[i].Sort();
		for(int j=0;j<WW;j++) Ver[j].Sort();
		
		
		var ac = new Acc2();
		ac.Init(m);
		
		long cv = 0;
		
		for(int x=0;x<WW;x++){
			if(Ver[x].Count < 2) continue;
			for(int i=0;i<Ver[x].Count;i++){
				for(int j=i+1;j<Ver[x].Count;j++){
					int y = Ver[x][i];
					int l = Ver[x][j] - Ver[x][i];
					if(x + l <WW){
						cv += ac.Sum(x + l, y + 1, x + l + 1, y + l);
					}
					if(x - l >= 0){
						cv += ac.Sum(x - l, y + 1, x - l + 1, y + l);
					}
				}
			}
		}
		
		for(int y=0;y<HH;y++){
			if(Hor[y].Count < 2) continue;
			for(int i=0;i<Hor[y].Count;i++){
				for(int j=i+1;j<Hor[y].Count;j++){
					int x = Hor[y][i];
					int l = Hor[y][j] - Hor[y][i];
					if(y + l <HH){
						cv += ac.Sum(x + 1, y + l, x + l, y + l + 1);
					}
					if(y - l >= 0){
						cv += ac.Sum(x + 1, y - l, x + l, y - l + 1);
					}
				}
			}
		}
		
		
		
		
		
		foreach(var yx in h){
			int y = yx / WW;
			int x = yx % WW;
			//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)){
					if(m[y1][x1] == 1 && m[y2][x2] == 1) cv++;
					continue;
				}
				break;
			}
			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)){
					if(m[y1][x1] == 1 && m[y2][x2] == 1) cv++;
					continue;
				}
				break;
			}
			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)){
					if(m[y1][x1] == 1 && m[y2][x2] == 1) cv++;
					continue;
				}
				break;
			}
			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)){
					if(m[y1][x1] == 1 && m[y2][x2] == 1) cv++;
					continue;
				}
				break;
			}
		}
		
		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];
			}
		}
	}
}

Measured memory_bytes: 23648