#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, 1};
int dy[] = {0, 1, 0, 1};
char a[52][52];
bool f(int j, int k) {
  bool vis[30];
  memset(vis, 0, sizeof vis);
  for (int i = 0; i < 4; ++i) vis[a[j + dx[i]][k + dy[i]] - 'a'] = true;
  return (vis[0] && vis[2] && vis[4] && vis[5]);
}
int main(int argc, char const* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> a[i];
  int sol = 0;
  for (int i = 0; i < n - 1; ++i)
    for (int j = 0; j < m - 1; ++j)
      if (f(i, j)) sol++;
  cout << sol << '\n';
  return 0;
}
