#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-ffloat-store")
#pragma GCC optimize("-fno-defer-pop")
long long int power(long long int a, long long int b, long long int m) {
  if (b == 0) return 1;
  if (b == 1) return a % m;
  long long int t = power(a, b / 2, m) % m;
  t = (t * t) % m;
  if (b & 1) t = ((t % m) * (a % m)) % m;
  return t;
}
long long int modInverse(long long int a, long long int m) {
  return power(a, m - 2, m);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, k, l, n, m;
  cin >> n >> m;
  char ar[51][51];
  for (i = 0; i < n; i++) {
    cin >> ar[i];
  }
  long long int count = 0;
  for (i = 0; i + 1 < n; i++) {
    for (j = 0; j + 1 < m; j++) {
      long long int g, h, f = 0, a = 0, c = 0, e = 0;
      for (g = i; g <= i + 1; g++) {
        for (h = j; h <= j + 1; h++) {
          if (ar[g][h] == 'f') {
            f = 1;
          } else if (ar[g][h] == 'a') {
            a = 1;
          } else if (ar[g][h] == 'c') {
            c = 1;
          } else if (ar[g][h] == 'e') {
            e = 1;
          }
        }
      }
      if (f == 1 && a == 1 && c == 1 && e == 1) {
        count++;
      }
    }
  }
  cout << count;
  return 0;
}
