#include <bits/stdc++.h>
using namespace std;
char s[200][200][200];
int d[3][3][3];
int with[3][3][3];
int without[3][3][3];
int n, m, k;
void calc(int mask[3][3][3]) {
  for (int a = 0; a <= 1; a++) {
    for (int b = 0; b <= 1; b++) {
      for (int c = 0; c <= 1; c++) {
        if (a + b + c < 3 && d[a][b][c]) {
          mask[a][b][c] = 1 << (a | (b << 1) | (c << 2));
        }
      }
    }
  }
  for (int sum = 0; sum < 9; sum++) {
    for (int a = 0; a < 3; a++) {
      for (int b = 0; b < 3; b++) {
        for (int c = 0; c < 3 && a + b + c <= sum; c++) {
          if (a + b + c == sum) {
            if (d[a][b][c] && mask[a][b][c]) {
              for (int da = 0; da <= 1 && a + da < 3; da++) {
                for (int db = 0; db <= 1 && b + db < 3; db++) {
                  for (int dc = 0; dc <= 1 && c + dc < 3; dc++) {
                    if (da + db + dc == 1 && d[a + da][b + db][c + dc]) {
                      mask[a + da][b + db][c + dc] |= mask[a][b][c];
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
int getcube(int ia, int ib, int ic) {
  for (int da = -1; da <= 1; da++) {
    for (int db = -1; db <= 1; db++) {
      for (int dc = -1; dc <= 1; dc++) {
        int ca = ia + da;
        int cb = ib + db;
        int cc = ic + dc;
        int bit = 0;
        if (0 <= ca && ca < n && 0 <= cb && cb < m && 0 <= cc && cc < k &&
            s[ca][cb][cc] == '1') {
          bit = 1;
        }
        d[da + 1][db + 1][dc + 1] = bit;
      }
    }
  }
  memset(with, 0, sizeof with);
  memset(without, 0, sizeof without);
  assert(d[1][1][1] == 1);
  calc(with);
  d[1][1][1] = 0;
  calc(without);
  for (int a = 1; a < 3; a++) {
    for (int b = 1; b < 3; b++) {
      for (int c = 1; c < 3; c++) {
        if (a + b + c > 3 && with[a][b][c] != without[a][b][c]) {
          return 1;
        }
      }
    }
  }
  return 0;
}
bool solve() {
  if (scanf("%d %d %d", &n, &m, &k) == 3) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        scanf(" %s", s[i][j]);
        assert(strlen(s[i][j]) == k);
      }
    }
    int ans = 0;
    for (int a = 0; a < n; a++) {
      for (int b = 0; b < m; b++) {
        for (int c = 0; c < k; c++) {
          if (s[a][b][c] == '1') {
            ans += getcube(a, b, c);
          }
        }
      }
    }
    printf("%d\n", ans);
    return true;
  }
  return false;
}
int main() {
  auto t = clock() / CLOCKS_PER_SEC;
  while (solve()) {
    auto nt = clock() / CLOCKS_PER_SEC;
    cerr << "TIME " << (nt - t) << endl;
    t = nt;
  }
  return 0;
}
