#include <bits/stdc++.h>
using namespace std;
int h = 'a' * 'f' * 'c' * 'e';
int main() {
  int n, m;
  cin >> n >> m;
  char c[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> c[i][j];
    }
  }
  int d = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m - 1; j++) {
      if (c[i][j] * c[i + 1][j] * c[i][j + 1] * c[i + 1][j + 1] == h) {
        d++;
      }
    }
  }
  cout << d;
}
