#include <bits/stdc++.h>
using namespace std;
char a[51][51] = {0};
long long has[200] = {0};
int main() {
  long long n = 0, m = 0, i = 0, j = 0, count = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < m - 1; j++) {
      has[a[i][j]]++;
      has[a[i + 1][j]]++;
      has[a[i][j + 1]]++;
      has[a[i + 1][j + 1]]++;
      if (has[102] == 1 && has[97] == 1 && has[99] == 1 && has[101] == 1) {
        count++;
      }
      has[102] = has[97] = has[99] = has[101] = 0;
    }
  }
  cout << count << endl;
  return 0;
}
