#include <bits/stdc++.h>
using namespace std;
bool ***processors;
int length, width, heigth;
struct point {
  int x;
  int y;
  int z;
  point() {}
  point(int a, int b, int c) : x(a), y(b), z(c) {}
};
void input() {
  std::cin >> length >> width >> heigth;
  processors = new bool **[length];
  string s;
  for (int i = 0; i < length; ++i) {
    processors[i] = new bool *[width];
    for (int j = 0; j < width; ++j) {
      processors[i][j] = new bool[heigth];
      std::cin >> s;
      for (int k = 0; k < heigth; ++k) {
        processors[i][j][k] = '1' == s[k];
      }
    }
  }
}
inline bool getState(const point a) {
  if (a.x < 0 || a.x == length) return false;
  if (a.y < 0 || a.y == width) return false;
  if (a.z < 0 || a.z == heigth) return false;
  return processors[a.x][a.y][a.z];
}
inline bool hasPath(const point p1, const point p2) {
  if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) return true;
  point newP = p1;
  if (p1.x < p2.x) {
    newP.x = p1.x + 1;
    if (getState(newP) && hasPath(newP, p2)) return true;
  }
  if (p1.y < p2.y) {
    newP = p1;
    newP.y = p1.y + 1;
    if (getState(newP) && hasPath(newP, p2)) return true;
  }
  if (p1.z < p2.z) {
    newP = p1;
    newP.z = p1.z + 1;
    if (getState(newP) && hasPath(newP, p2)) return true;
  }
  return false;
}
bool isCritical(const point p) {
  if (!getState(p)) return false;
  point pr = p, nx = p;
  pr.x--;
  nx.x++;
  if (getState(pr) && getState(nx)) return true;
  pr = nx = p;
  pr.y--;
  nx.y++;
  if (getState(pr) && getState(nx)) return true;
  pr = nx = p;
  pr.z--;
  nx.z++;
  if (getState(pr) && getState(nx)) return true;
  bool result = false;
  processors[p.x][p.y][p.z] = false;
  pr = p;
  pr.x--;
  if (getState(pr)) {
    nx = p;
    nx.y = p.y + 1;
    result = getState(nx) && !hasPath(pr, nx);
    if (!result) {
      nx = p;
      nx.z++;
      result = getState(nx) && !hasPath(pr, nx);
    }
  }
  if (result) {
    processors[p.x][p.y][p.z] = true;
    return true;
  }
  pr = p;
  pr.y--;
  if (getState(pr)) {
    nx = p;
    nx.x = p.x + 1;
    result = getState(nx) && !hasPath(pr, nx);
    if (!result) {
      nx = p;
      nx.z++;
      result = getState(nx) && !hasPath(pr, nx);
    }
  }
  if (result) {
    processors[p.x][p.y][p.z] = true;
    return true;
  }
  pr = p;
  pr.z--;
  if (getState(pr)) {
    nx = p;
    nx.x = p.x + 1;
    result = getState(nx) && !hasPath(pr, nx);
    if (!result) {
      nx = p;
      nx.y++;
      result = getState(nx) && !hasPath(pr, nx);
    }
  }
  processors[p.x][p.y][p.z] = true;
  return result;
}
long calcCount() {
  long count = 0;
  point p;
  for (p.x = 0; p.x < length; p.x++)
    for (p.y = 0; p.y < width; p.y++)
      for (p.z = 0; p.z < heigth; p.z++)
        if (isCritical(p)) count++;
  return count;
}
int main() {
  input();
  cout << calcCount() << '\n';
  return 0;
}
