#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &x) {
  x = 0;
  int f = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    f |= (ch == '-');
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  x = f ? -x : x;
  return;
}
char a[100][100];
int n, m;
int ans;
int main() {
  read(n);
  read(m);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  for (int i = 1; i <= n - 1; i++) {
    for (int j = 1; j <= m - 1; j++) {
      int wf = 0, wa = 0, wc = 0, we = 0;
      if (a[i][j] == 'f') wf++;
      if (a[i][j] == 'a') wa++;
      if (a[i][j] == 'c') wc++;
      if (a[i][j] == 'e') we++;
      if (a[i][j + 1] == 'f') wf++;
      if (a[i][j + 1] == 'a') wa++;
      if (a[i][j + 1] == 'c') wc++;
      if (a[i][j + 1] == 'e') we++;
      if (a[i + 1][j] == 'f') wf++;
      if (a[i + 1][j] == 'a') wa++;
      if (a[i + 1][j] == 'c') wc++;
      if (a[i + 1][j] == 'e') we++;
      if (a[i + 1][j + 1] == 'f') wf++;
      if (a[i + 1][j + 1] == 'a') wa++;
      if (a[i + 1][j + 1] == 'c') wc++;
      if (a[i + 1][j + 1] == 'e') we++;
      if (wf && wa && wc && we) ans++;
    }
  }
  printf("%d", ans);
  return 0;
}
