#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<vector<vector<bool> > > controlled;
  int n, m, k;
  cin >> n >> m >> k;
  string buffer;
  controlled.resize(n + 2);
  for (int x = 0; x < n + 2; ++x) {
    controlled[x].resize(m + 2);
    for (int y = 0; y < m + 2; ++y) controlled[x][y].resize(k + 2);
  }
  for (int x = 1; x <= n; ++x) {
    for (int y = 1; y <= m; ++y) {
      cin >> buffer;
      for (int z = 1; z <= k; ++z) controlled[x][y][z] = buffer[z - 1] == '1';
    }
  }
  for (int x = 0; x < n + 2; ++x) {
    for (int y = 0; y < m + 2; ++y)
      controlled[x][y][0] = controlled[x][y][k + 1] = false;
    for (int z = 0; z < k + 2; ++z)
      controlled[x][0][z] = controlled[x][m + 1][z] = false;
  }
  for (int y = 0; y < m + 2; ++y)
    for (int z = 0; z < k + 2; ++z)
      controlled[0][y][z] = controlled[n + 1][y][z] = false;
  int result = 0;
  for (int x = 1; x <= n; ++x)
    for (int y = 1; y <= m; ++y)
      for (int z = 1; z <= k; ++z)
        if (controlled[x][y][z]) {
          bool ruinsSomething = false;
          ruinsSomething |= controlled[x - 1][y][z] && controlled[x + 1][y][z];
          ruinsSomething |= controlled[x][y - 1][z] && controlled[x][y + 1][z];
          ruinsSomething |= controlled[x][y][z - 1] && controlled[x][y][z + 1];
          ruinsSomething |= controlled[x - 1][y][z] &&
                            controlled[x][y + 1][z] &&
                            !controlled[x - 1][y + 1][z];
          ruinsSomething |= controlled[x - 1][y][z] &&
                            controlled[x][y][z + 1] &&
                            !controlled[x - 1][y][z + 1];
          ruinsSomething |= controlled[x][y - 1][z] &&
                            controlled[x + 1][y][z] &&
                            !controlled[x + 1][y - 1][z];
          ruinsSomething |= controlled[x][y - 1][z] &&
                            controlled[x][y][z + 1] &&
                            !controlled[x][y - 1][z + 1];
          ruinsSomething |= controlled[x][y][z - 1] &&
                            controlled[x + 1][y][z] &&
                            !controlled[x + 1][y][z - 1];
          ruinsSomething |= controlled[x][y][z - 1] &&
                            controlled[x][y + 1][z] &&
                            !controlled[x][y + 1][z - 1];
          if (ruinsSomething) ++result;
        }
  cout << result;
  return 0;
}
