#include <bits/stdc++.h>
void taskA() {
  int n = 0;
  std::cin >> n;
  int pos_of_max = 0;
  std::vector<int> count(1000000);
  for (int i = 0; i < n; ++i) {
    int student = 0;
    std::cin >> student;
    count[student - 1]++;
    if (count[student - 1] > count[pos_of_max]) {
      pos_of_max = student - 1;
    }
  }
  std::cout << pos_of_max + 1 << std::endl;
}
void taskB() {
  int n = 0;
  std::cin >> n;
  std::vector<std::string> names(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> names[i];
  }
  std::set<std::string> set;
  for (int i = n - 1; i >= 0; --i) {
    if (set.find(names[i]) == set.end()) {
      std::cout << names[i] << std::endl;
      set.insert(names[i]);
    }
  }
}
void taskC() {
  int n = 0;
  std::cin >> n;
  std::vector<std::string> codes(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> codes[i];
  }
  if (n == 1) {
    std::cout << 6 << std::endl;
    return;
  }
  int max_match = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int curr_res = 0;
      for (int k = 0; k < 6; ++k) {
        if (codes[i][k] == codes[j][k]) {
          curr_res++;
        }
      }
      max_match = std::max(max_match, curr_res);
    }
  }
  int ans = (6 - max_match + 1) / 2 - 1;
  std::cout << ans << std::endl;
}
int bin_search(const std::vector<int>& barriers, int x, int closest_right) {
  int left = closest_right;
  int right = static_cast<int>(barriers.size());
  while (right - left > 1) {
    int middle = (left + right) / 2;
    if (barriers[middle] < x) {
      left = middle;
    } else {
      right = middle;
    }
  }
  return left;
}
struct Action {
  Action() {}
  Action(std::string _type, int _len) : type(_type), length(_len) {}
  void print() { std::cout << type << " " << length << std::endl; }
  std::string type;
  int length;
};
void taskD() {
  int n = 0, m = 0, s = 0, d = 0;
  std::cin >> n >> m >> s >> d;
  std::vector<int> barriers(n);
  for (int i = 0; i < n; ++i) {
    std::cin >> barriers[i];
  }
  if (d == 1) {
    std::cout << "IMPOSSIBLE" << std::endl;
    return;
  }
  std::sort(barriers.begin(), barriers.end());
  int closest_right = 0;
  int curr_pos = 0;
  std::vector<Action> actions;
  while (true) {
    if (closest_right < barriers.size()) {
      if (barriers[closest_right] - 1 - curr_pos < s) {
        std::cout << "IMPOSSIBLE" << std::endl;
        return;
      }
      actions.push_back(Action("RUN", barriers[closest_right] - 1 - curr_pos));
      curr_pos = barriers[closest_right] - 1;
    } else {
      actions.push_back(Action("RUN", m - curr_pos));
      break;
    }
  }
}
void _taskA() {
  int n = 0, a = 0;
  std::cin >> n >> a;
  if (a % 2 == 0) {
    a = n - a + 1;
  }
  std::cout << (a + 1) / 2 << std::endl;
}
void dfs(int v, const std::vector<int>& next, const std::vector<int>& prev,
         std::vector<bool>& was) {
  if (prev[v] != -1 && !was[prev[v]]) {
    dfs(prev[v], next, prev, was);
  }
  if (!was[v]) {
    std::cout << static_cast<char>(v + 'a');
    was[v] = true;
  }
  if (next[v] != -1 && !was[next[v]]) {
    dfs(next[v], next, prev, was);
    was[v] = true;
  }
}
void _taskB() {
  std::vector<int> next(26, -1);
  std::vector<int> prev(26, -1);
  std::vector<bool> was(26, false);
  std::vector<bool> used(26, false);
  int n = 0;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    std::string s;
    std::cin >> s;
    for (int j = 0; j < s.size(); ++j) {
      used[s[j] - 'a'] = true;
      prev[s[j] - 'a'] = (j > 0) ? s[j - 1] - 'a' : prev[s[j] - 'a'];
      next[s[j] - 'a'] = (j < s.size() - 1) ? s[j + 1] - 'a' : next[s[j] - 'a'];
    }
  }
  for (int v = 0; v < 26; ++v) {
    if (!was[v] && used[v]) {
      dfs(v, next, prev, was);
    }
  }
  std::cout << std::endl;
}
using b_vector3D = std::vector<std::vector<std::vector<char> > >;
using b_vector2D = std::vector<std::vector<char> >;
using b_vector1D = std::vector<char>;
bool is_correct(int i, int j, int z, int n, int m, int k,
                const b_vector3D& cube) {
  return (i >= 0 && i < n && j >= 0 && j < m && z >= 0 && z < k &&
          cube[i][j][z] == '1');
}
void _taskD() {
  int n = 0, m = 0, k = 0;
  std::cin >> n >> m >> k;
  b_vector3D cube(n, b_vector2D(m, b_vector1D(k)));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int z = 0; z < k; ++z) {
        std::cin >> cube[i][j][z];
      }
    }
  }
  int count = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int z = 0; z < k; ++z) {
        if (cube[i][j][z] == '1') {
          if ((is_correct(i + 1, j, z, n, m, k, cube) &&
               is_correct(i - 1, j, z, n, m, k, cube)) ||
              (is_correct(i, j + 1, z, n, m, k, cube) &&
               is_correct(i, j - 1, z, n, m, k, cube)) ||
              (is_correct(i, j, z + 1, n, m, k, cube) &&
               is_correct(i, j, z - 1, n, m, k, cube))) {
            count++;
            continue;
          }
          if (is_correct(i + 1, j, z, n, m, k, cube) &&
              is_correct(i, j - 1, z, n, m, k, cube) &&
              !is_correct(i + 1, j - 1, z, n, m, k, cube)) {
            count++;
            continue;
          }
          if (is_correct(i + 1, j, z, n, m, k, cube) &&
              is_correct(i, j, z - 1, n, m, k, cube) &&
              !is_correct(i + 1, j, z - 1, n, m, k, cube)) {
            count++;
            continue;
          }
          if (is_correct(i, j + 1, z, n, m, k, cube) &&
              is_correct(i - 1, j, z, n, m, k, cube) &&
              !is_correct(i - 1, j + 1, z, n, m, k, cube)) {
            count++;
            continue;
          }
          if (is_correct(i, j + 1, z, n, m, k, cube) &&
              is_correct(i, j, z - 1, n, m, k, cube) &&
              !is_correct(i, j + 1, z - 1, n, m, k, cube)) {
            count++;
            continue;
          }
          if (is_correct(i, j, z + 1, n, m, k, cube) &&
              is_correct(i - 1, j, z, n, m, k, cube) &&
              !is_correct(i - 1, j, z + 1, n, m, k, cube)) {
            count++;
            continue;
          }
          if (is_correct(i, j, z + 1, n, m, k, cube) &&
              is_correct(i, j - 1, z, n, m, k, cube) &&
              !is_correct(i, j - 1, z + 1, n, m, k, cube)) {
            count++;
            continue;
          }
        }
      }
    }
  }
  std::cout << count << std::endl;
}
int main() {
  _taskD();
  return 0;
}
