#include <bits/stdc++.h>
using namespace std;
int n, m, k;
vector<vector<int> > g;
vector<vector<int> > revg;
int active[1000005];
int del;
int limx, limy, limz;
unordered_set<int> visited;
void add(int a, int b) {
  if (active[a] && active[b]) {
    g[a].push_back(b);
    revg[b].push_back(a);
  }
}
int get(int a, int b, int c) { return a * m * k + b * k + c; }
bool downlimit(int v) {
  if (v == del) return false;
  int z(v % k);
  v /= k;
  int y(v % m);
  int x(v / m);
  return x <= limx && y <= limy && z <= limz;
}
void dfs(int v) {
  visited.insert(v);
  for (int i(0), _l((int)(((int)g[v].size())) - 1); i <= _l; ++i) {
    int to(g[v][i]);
    if (downlimit(to)) dfs(to);
  }
}
void solve() {
  memset((active), 0, sizeof(active));
  scanf("%d%d%d\n", &n, &m, &k);
  g.resize(n * m * k);
  revg.resize(n * m * k);
  for (int i(0), _l((int)(n)-1); i <= _l; ++i)
    for (int j(0), _l((int)(m)-1); j <= _l; ++j) {
      string s;
      getline(cin, s);
      for (int q(0), _l((int)(k)-1); q <= _l; ++q)
        active[get(i, j, q)] = (s[q] == '1');
      if (j == m - 1) getline(cin, s);
    }
  for (int i(0), _l((int)(n)-1); i <= _l; ++i)
    for (int j(0), _l((int)(m)-1); j <= _l; ++j)
      for (int q(0), _l((int)(k)-1); q <= _l; ++q) {
        if (i < n - 1) add(get(i, j, q), get(i + 1, j, q));
        if (j < m - 1) add(get(i, j, q), get(i, j + 1, q));
        if (q < k - 1) add(get(i, j, q), get(i, j, q + 1));
      }
  int ans(0);
  for (int x(0), _l((int)(n)-1); x <= _l; ++x)
    for (int y(0), _l((int)(m)-1); y <= _l; ++y)
      for (int z(0), _l((int)(k)-1); z <= _l; ++z) {
        int v(get(x, y, z));
        del = v;
        limx = x + 1, limy = y + 1, limz = z + 1;
        bool frogs(false);
        for (int i(0), _l((int)(((int)revg[v].size())) - 1); i <= _l; ++i) {
          int from(revg[v][i]);
          visited.clear();
          dfs(from);
          for (int j(0), _l((int)(((int)g[v].size())) - 1); j <= _l; ++j) {
            int to(g[v][j]);
            if (!visited.count(to)) frogs = true;
            if (frogs) break;
          }
          if (frogs) break;
        }
        ans += frogs;
      }
  printf("%d\n", ans);
}
int main() {
  solve();
  return 0;
}
