#include <bits/stdc++.h>
int main() {
  int n, m;
  int j, i, b[27];
  char a[100][100];
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%s", &a[i]);
  }
  int ans = 0, k;
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < m - 1; j++) {
      for (k = 0; k < 26; k++) b[k] = 0;
      b[a[i][j] - 97] = 1;
      b[a[i][j + 1] - 97] = 1;
      b[a[i + 1][j] - 97] = 1;
      b[a[i + 1][j + 1] - 97] = 1;
      if (b[0] == 1 && b[2] == 1 && b[4] == 1 && b[5] == 1) ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
