#include <bits/stdc++.h>
using namespace std;
inline int max3(int a, int b, int c) { return max(a, max(b, c)); }
inline int min3(int a, int b, int c) { return min(a, min(b, c)); }
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-6;
const double PI = acos(-1.0);
const int maxn = 150;
int n, m, k;
int a[maxn][maxn][maxn];
int ans;
int main() {
  scanf("%d %d %d\n", &n, &m, &k);
  char b[maxn];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      gets(b);
      for (int p = 0; p < k; ++p) a[i][j][p] = b[p] == '1';
    }
    if (i < n - 1) gets(b);
  }
  ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int p = 0; p < k; ++p) {
        if (!a[i][j][p]) continue;
        if ((p > 0 && p < k - 1 && a[i][j][p - 1] && a[i][j][p + 1]) ||
            (p > 0 && j < m - 1 && a[i][j][p - 1] && a[i][j + 1][p] &&
             !a[i][j + 1][p - 1]) ||
            (p > 0 && i < n - 1 && a[i][j][p - 1] && a[i + 1][j][p] &&
             !a[i + 1][j][p - 1]) ||
            (j > 0 && j < m - 1 && a[i][j - 1][p] && a[i][j + 1][p]) ||
            (j > 0 && p < k - 1 && a[i][j - 1][p] && a[i][j][p + 1] &&
             !a[i][j - 1][p + 1]) ||
            (j > 0 && i < n - 1 && a[i][j - 1][p] && a[i + 1][j][p] &&
             !a[i + 1][j - 1][p]) ||
            (i > 0 && i < n - 1 && a[i - 1][j][p] && a[i + 1][j][p]) ||
            (i > 0 && j < m - 1 && a[i - 1][j][p] && a[i][j + 1][p] &&
             !a[i - 1][j + 1][p]) ||
            (i > 0 && p < k - 1 && a[i - 1][j][p] && a[i][j][p + 1] &&
             !a[i - 1][j][p + 1]))
          ++ans;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
