#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  bool f = 0;
  bool a = 0;
  bool c = 0;
  int n = 0;
  bool e = 0;
  int num[4];
  cin >> x >> y;
  char arr[55][55];
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      e = 0;
      f = 0;
      c = 0;
      a = 0;
      num[0] = arr[i][j];
      num[1] = arr[i][j + 1];
      num[2] = arr[i + 1][j];
      num[3] = arr[i + 1][j + 1];
      if (num[0] == 'f' || num[1] == 'f' || num[2] == 'f' || num[3] == 'f') {
        f = 1;
      }
      if (num[0] == 'a' || num[1] == 'a' || num[2] == 'a' || num[3] == 'a') {
        a = 1;
      }
      if (num[0] == 'c' || num[1] == 'c' || num[2] == 'c' || num[3] == 'c') {
        c = 1;
      }
      if (num[0] == 'e' || num[1] == 'e' || num[2] == 'e' || num[3] == 'e') {
        e = 1;
      }
      if (f == 1 && a == 1 && c == 1 && e == 1) {
        n++;
      }
      f = 0, a = 0, c = 0, e = 0;
    }
  }
  cout << n;
}
