#include <bits/stdc++.h>
using namespace std;
bool w[109][109][109];
bool a[3][3][3];
bool usd[3][3][3];
const int dx[3] = {1, 0, 0};
const int dy[3] = {0, 1, 0};
const int dz[3] = {0, 0, 1};
void dfs(int x, int y, int z) {
  usd[x][y][z] = 1;
  for (int d = 0; d < 3; ++d) {
    int nx = x + dx[d];
    int ny = y + dy[d];
    int nz = z + dz[d];
    if ((nx >= 0 && ny >= 0 && nz >= 0) && (nx < 3 && ny < 3 && nz < 3) &&
        a[nx][ny][nz] && !usd[nx][ny][nz])
      dfs(nx, ny, nz);
  }
}
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i <= n + 1; ++i)
    for (int j = 0; j <= m + 1; ++j)
      for (int t = 0; t <= k + 1; ++t)
        if ((i == 0 || j == 0 || t == 0) ||
            (i == n + 1 || j == m + 1 || t == k + 1)) {
          w[i][j][t] = 0;
        } else {
          char c;
          cin >> c;
          c -= '0';
          w[i][j][t] = c;
        }
  int ans = 0;
  for (int x = 1; x <= n; ++x)
    for (int y = 1; y <= m; ++y)
      for (int z = 1; z <= k; ++z)
        if (w[x][y][z]) {
          for (int i = -1; i <= 1; ++i)
            for (int j = -1; j <= 1; ++j)
              for (int t = -1; t <= 1; ++t)
                a[1 + i][1 + j][1 + t] = w[x + i][y + j][z + t];
          a[1][1][1] = 0;
          bool f = true;
          for (int d = 0; d < 3 && f; ++d) {
            int x1 = 1 - dx[d];
            int y1 = 1 - dy[d];
            int z1 = 1 - dz[d];
            if (a[x1][y1][z1]) {
              dfs(x1, y1, z1);
              for (int d2 = 0; d2 < 3 && f; ++d2) {
                int x2 = 1 + dx[d2];
                int y2 = 1 + dy[d2];
                int z2 = 1 + dz[d2];
                if (a[x2][y2][z2] && !usd[x2][y2][z2]) f = false;
              }
              for (int i = 0; i < 3; ++i)
                for (int j = 0; j < 3; ++j)
                  for (int t = 0; t < 3; ++t) usd[i][j][t] = 0;
            }
          }
          if (!f) {
            ++ans;
          }
        }
  cout << ans << endl;
}
