import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.container;

void main()
{
	auto hw = readln.chomp.split.map!(to!int);
	auto field = new string[](hw[0]);
	foreach (i; 0..hw[0]) {
		field[i] = readln.chomp;
	}
	int cnt;
	foreach (y; 0..hw[0]-1) {
		foreach (x; 0..hw[1]-1) {
			bool f, a, c, e;
			foreach (i; 0..2) {
				foreach (j;0..2) {
					if (field[y+i][x+j] == 'f') f = 1;
					if (field[y+i][x+j] == 'a') a = 1;
					if (field[y+i][x+j] == 'c') c = 1;
					if (field[y+i][x+j] == 'e') e = 1;
				}
			}
			if (f + a + c + e == 4) cnt++;
		}
	}
	cnt.writeln;
}