#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <class T>
inline bool Min(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
inline bool Max(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
inline void pi(int a) { printf("%d ", a); }
inline void pl(ll a) { printf("%lld ", a); }
inline void pd(double a) { printf("%.12lf ", a); }
inline int ni() {
  int a;
  scanf("%d", &a);
  return a;
}
inline ll nl() {
  ll a;
  scanf("%lld", &a);
  return a;
}
inline double nd() {
  double a;
  scanf("%lf", &a);
  return a;
}
const int N = 105;
int comp[N][N][N];
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  string s;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      cin >> s;
      for (int t = 0; t < k; ++t) comp[i][j][t] = (s[t] == '1') ? 1 : 0;
    }
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      for (int t = 0; t < k; ++t) {
        if (i > 0 && j > 0 && comp[i][j][t] && comp[i - 1][j][t] &&
            comp[i - 1][j - 1][t] && !comp[i][j - 1][t])
          comp[i - 1][j][t] = 2;
        if (i > 0 && j > 0 && comp[i][j][t] && !comp[i - 1][j][t] &&
            comp[i - 1][j - 1][t] && comp[i][j - 1][t])
          comp[i][j - 1][t] = 2;
        if (j > 0 && t > 0 && comp[i][j][t] && comp[i][j - 1][t] &&
            comp[i][j - 1][t - 1] && !comp[i][j][t - 1])
          comp[i][j - 1][t] = 2;
        if (j > 0 && t > 0 && comp[i][j][t] && !comp[i][j - 1][t] &&
            comp[i][j - 1][t - 1] && comp[i][j][t - 1])
          comp[i][j][t - 1] = 2;
        if (i > 0 && t > 0 && comp[i][j][t] && comp[i - 1][j][t] &&
            comp[i - 1][j][t - 1] && !comp[i][j][t - 1])
          comp[i - 1][j][t] = 2;
        if (i > 0 && t > 0 && comp[i][j][t] && !comp[i - 1][j][t] &&
            comp[i - 1][j][t - 1] && comp[i][j][t - 1])
          comp[i][j][t - 1] = 2;
        if (i > 1 && comp[i][j][t] && comp[i - 1][j][t] && comp[i - 2][j][t])
          comp[i - 1][j][t] = 2;
        if (j > 1 && comp[i][j][t] && comp[i][j - 1][t] && comp[i][j - 2][t])
          comp[i][j - 1][t] = 2;
        if (t > 1 && comp[i][j][t] && comp[i][j][t - 1] && comp[i][j][t - 2])
          comp[i][j][t - 1] = 2;
      }
  int cnt = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      for (int t = 0; t < k; ++t)
        if (comp[i][j][t] == 2) cnt++;
  cout << cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  srand((int)clock());
  solve();
  return 0;
}
