The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently busy preparing a contest for you, so you will have to do it for them. 

In this problem an image is a rectangular table that consists of lowercase Latin letters. A face on the image is a 2 × 2 square, such that from the four letters of this square you can make word "face". 

You need to write a program that determines the number of faces on the image. The squares that correspond to the faces can overlap.
The first line contains two space-separated integers, *n* and *m* (1 ≤ *n*, *m* ≤ 50) — the height and the width of the image, respectively.

Next *n* lines define the image. Each line contains *m* lowercase Latin letters.
from sys import stdin; inp = stdin.readline
from math import dist, ceil, floor, sqrt, log
from collections import defaultdict, Counter, deque
def IA(sep=' '): return list(map(int, inp().split(sep)))
def QIA(sep=' '): return deque(map(int, inp().split(sep)))
def FA(): return list(map(float, inp().split()))
def SA(): return list(input())
def I(): return int(inp())
def F(): return float(inp())
def S(): return input()
def O(l:list): return ' '.join(map(str, l))

def main():
    n, m = IA()
    mat = []
    char = set('face')
    count = 0
    for _  in range(n):
        s = S()
        mat.append(s)
    for i in range(n):
        for j in range(m):
            cell = mat[i][j]
            if cell in char:
                temp = set()
                temp.add(cell)
                try:
                    l = [mat[i][j+1], mat[i+1][j], mat[i+1][j+1]]
                    for c in l:
                        if c in char:
                            temp.add(c)
                except:
                    IndexError() 
                if temp == char:
                    count += 1 
    return count                
    

if __name__ == '__main__':
    print(main())