#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 110;
bool space[MAX_SIZE][MAX_SIZE][MAX_SIZE];
int N, M, K;
void read_state() {
  for (int i = 0; i < MAX_SIZE; ++i)
    for (int j = 0; j < MAX_SIZE; ++j)
      for (int k = 0; k < MAX_SIZE; ++k) space[i][j][k] = false;
  string states = "";
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j) {
      cin >> states;
      for (int k = 1; k <= K; ++k) space[i][j][k] = (states[k - 1] == '1');
    }
  return;
}
bool is_important(int i, int j, int k) {
  if ((space[i - 1][j][k] && space[i + 1][j][k]) ||
      (space[i][j - 1][k] && space[i][j + 1][k]) ||
      (space[i][j][k - 1] && space[i][j][k + 1])) {
    return true;
  }
  if (space[i - 1][j][k]) {
    if (space[i][j + 1][k] && !space[i - 1][j + 1][k]) return true;
    if (space[i][j][k + 1] && !space[i - 1][j][k + 1]) return true;
  }
  if (space[i][j - 1][k]) {
    if (space[i + 1][j][k] && !space[i + 1][j - 1][k]) return true;
    if (space[i][j][k + 1] && !space[i][j - 1][k + 1]) return true;
  }
  if (space[i][j][k - 1]) {
    if (space[i + 1][j][k] && !space[i + 1][j][k - 1]) return true;
    if (space[i][j + 1][k] && !space[i][j + 1][k - 1]) return true;
  }
  return false;
}
void print_state() {
  for (int i = 1; i <= N; ++i, cout << endl)
    for (int j = 1; j <= M; ++j, cout << endl)
      for (int k = 1; k <= K; ++k) {
        if (space[i][j][k]) {
          if (is_important(i, j, k))
            cout << '*';
          else
            cout << '1';
        } else {
          cout << '0';
        }
      }
  return;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin >> N >> M >> K;
  read_state();
  int answer = 0;
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j)
      for (int k = 1; k <= K; ++k) {
        if (space[i][j][k]) answer += is_important(i, j, k);
      }
  cout << answer << endl;
  return 0;
}
