#include <bits/stdc++.h>
using namespace std;
struct cell {
  bool isWork, isCritical;
  cell() : isWork(false), isCritical(false){};
};
void check1(vector<vector<vector<cell>>>& c, int i, int j, int u, int di,
            int dj, int du) {
  if ((!di | i + di > 0) && (!dj | j + dj > 0) && (!du | u + du > 0)) {
    if (c[i + di][j + dj][u + du].isWork &&
        c[i + 2 * di][j + 2 * dj][u + 2 * du].isWork)
      c[i + di][j + dj][u + du].isCritical = true;
  }
}
void check2(vector<vector<vector<cell>>>& c, int i, int j, int u, int di,
            int dj, int du) {
  if (i + di >= 0 && j + dj >= 0 && u + du >= 0) {
    if (c[i + di][j + dj][u + du].isWork) {
      if (di == 0) {
        c[i][j][u + du].isCritical |=
            !c[i][j + dj][u].isWork & c[i][j][u + du].isWork;
        c[i][j + dj][u].isCritical |=
            !c[i][j][u + du].isWork & c[i][j + dj][u].isWork;
      }
      if (dj == 0) {
        c[i][j][u + du].isCritical |=
            !c[i + di][j][u].isWork & c[i][j][u + du].isWork;
        c[i + di][j][u].isCritical |=
            !c[i][j][u + du].isWork & c[i + di][j][u].isWork;
      }
      if (du == 0) {
        c[i][j + dj][u].isCritical |=
            !c[i + di][j][u].isWork & c[i][j + dj][u].isWork;
        c[i + di][j][u].isCritical |=
            !c[i][j + dj][u].isWork & c[i + di][j][u].isWork;
      }
    }
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<vector<vector<cell>>> c(
      n, vector<vector<cell>>(m, vector<cell>(k, cell())));
  string str;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> str;
      for (int u = 0; u < k; u++) {
        if (str[u] == '1') c[i][j][u].isWork = true;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int u = 0; u < k; u++) {
        if (c[i][j][u].isWork) {
          check1(c, i, j, u, 0, 0, -1);
          check1(c, i, j, u, 0, -1, 0);
          check1(c, i, j, u, -1, 0, 0);
          check2(c, i, j, u, 0, -1, -1);
          check2(c, i, j, u, -1, 0, -1);
          check2(c, i, j, u, -1, -1, 0);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int u = 0; u < k; u++) {
        if (c[i][j][u].isCritical) {
          ++ans;
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
