#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e2 + 10;
int n, m, k;
bool alive[MAXN * MAXN * MAXN];
int code(int x, int y, int z) { return x * m * k + y * k + z; }
bool read() {
  if (scanf("%d%d%d\n", &n, &m, &k) < 3) {
    return false;
  }
  memset(alive, 1, sizeof alive);
  for (int x = 0; x < (int)n; ++x) {
    scanf("\n");
    for (int y = 0; y < (int)m; ++y) {
      static char s[MAXN];
      gets(s);
      for (int z = 0; z < (int)k; ++z) {
        alive[code(x, y, z)] = s[z] == '1';
      }
    }
  }
  return true;
}
vector<int> g[MAXN * MAXN * MAXN];
vector<int> gt[MAXN * MAXN * MAXN];
bool path(int v, int to) {
  for (int u : g[v]) {
    if (!alive[u]) {
      continue;
    }
    for (int to_u : g[u]) {
      if (alive[to_u] && to_u == to) return true;
    }
  }
  return false;
}
bool check(int v) {
  alive[v] = false;
  for (int from : gt[v]) {
    for (int to : g[v]) {
      if (!path(from, to)) {
        alive[v] = true;
        return true;
      }
    }
  }
  alive[v] = true;
  return false;
}
void addE(int v, int to) {
  if (!alive[to]) {
    return;
  }
  g[v].push_back(to);
  gt[to].push_back(v);
}
int solve() {
  for (int x = 0; x < (int)n; ++x)
    for (int y = 0; y < (int)m; ++y)
      for (int z = 0; z < (int)k; ++z) {
        int v = code(x, y, z);
        if (!alive[v]) {
          continue;
        }
        if (x + 1 < n) {
          addE(v, code(x + 1, y, z));
        }
        if (y + 1 < m) {
          addE(v, code(x, y + 1, z));
        }
        if (z + 1 < k) {
          addE(v, code(x, y, z + 1));
        }
      }
  int ans = 0;
  for (int i = 0; i < (int)n * m * k; ++i) {
    if (alive[i]) {
      ans += check(i);
    }
  }
  return ans;
}
int main() {
  while (read()) {
    printf("%d\n", solve());
  }
  return 0;
}
