#include <bits/stdc++.h>
using namespace std;
const int mx = 123;
int N, M, K;
char d[mx][mx][mx];
char tmp[3][3];
int dir[3][3] = {{1, 1, 0}, {0, 1, 1}, {1, 0, 1}};
bool f(int p[3]) {
  for (int b = 0; b < 3; b++) {
    vector<int> c;
    for (int i = 0; i < 3; i++)
      if (dir[b][i]) c.push_back(i);
    for (int dr = -1; dr <= 1; dr++) {
      for (int dc = -1; dc <= 1; dc++) {
        int q[3] = {p[0], p[1], p[2]};
        q[c[0]] += dr;
        q[c[1]] += dc;
        tmp[dr + 1][dc + 1] = '0';
        if (0 <= q[0] && q[0] < N && 0 <= q[1] && q[1] < M && 0 <= q[2] &&
            q[2] < K) {
          tmp[dr + 1][dc + 1] = d[q[0]][q[1]][q[2]];
        }
      }
    }
    if (tmp[1][0] == '0' && tmp[0][1] == '0') continue;
    if (tmp[1][2] == '0' && tmp[2][1] == '0') continue;
    if (tmp[1][0] == '1' && tmp[2][0] == '1' && tmp[2][1] == '1' &&
        tmp[0][1] == '0' && tmp[1][2] == '0')
      continue;
    if (tmp[0][1] == '1' && tmp[0][2] == '1' && tmp[1][2] == '1' &&
        tmp[1][0] == '0' && tmp[2][1] == '0')
      continue;
    return false;
  }
  return true;
}
int main() {
  scanf("%d %d %d", &N, &M, &K);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++) scanf("%s", d[i][j]);
  int ans = 0;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < M; j++)
      for (int k = 0; k < K; k++) {
        int p[3] = {i, j, k};
        if (d[i][j][k] == '1' && !f(p)) ans++;
      }
  printf("%d\n", ans);
  return 0;
}
