#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
const int _i[] = {1, 0, 0};
const int _j[] = {0, 1, 0};
const int _k[] = {0, 0, 1};
char A[105][105][105];
bool used[105][105][105];
int n, m, r;
inline bool isWork(int i, int j, int k) { return A[i][j][k] == '1'; }
int main() {
  int i, j, k;
  scanf("%d %d %d", &n, &m, &r);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) scanf("%s", A[i][j] + 1);
  }
  auto res = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      for (k = 1; k <= r; k++) {
        if (!isWork(i, j, k)) continue;
        A[i][j][k] = '0';
        auto found = false;
        for (auto dir = 0; dir < 3; dir++) {
          for (auto ii = i - 1; ii <= i + 1; ii++)
            for (auto jj = j - 1; jj <= j + 1; jj++)
              for (auto kk = k - 1; kk <= k + 1; kk++) used[ii][jj][kk] = false;
          queue<int> q;
          if (isWork(i - _i[dir], j - _j[dir], k - _k[dir])) {
            q.push(i - _i[dir]);
            q.push(j - _j[dir]);
            q.push(k - _k[dir]);
            used[i - _i[dir]][j - _j[dir]][k - _k[dir]] = true;
          }
          if (q.empty()) continue;
          while (q.size()) {
            auto x = q.front();
            q.pop();
            auto y = q.front();
            q.pop();
            auto z = q.front();
            q.pop();
            for (auto dr = 0; dr < 3; dr++) {
              auto ii = x + _i[dr], jj = y + _j[dr], kk = z + _k[dr];
              if (ii <= i + 1 && jj <= j + 1 && kk <= k + 1 &&
                  isWork(ii, jj, kk) && !used[ii][jj][kk]) {
                q.push(ii);
                q.push(jj);
                q.push(kk);
                used[ii][jj][kk] = true;
              }
            }
          }
          if (!used[i + 1][j][k] && isWork(i + 1, j, k) ||
              !used[i][j + 1][k] && isWork(i, j + 1, k) ||
              !used[i][j][k + 1] && isWork(i, j, k + 1)) {
            found = true;
            break;
          }
        }
        res += found;
        A[i][j][k] = '1';
      }
    }
  }
  printf("%d\n", res);
}
