#include <bits/stdc++.h>
using namespace std;
bool a[111][111][111];
bool check3(int i, int j, int k) {
  return (a[i - 1][j][k] && a[i][j][k] && a[i + 1][j][k]) ||
         (a[i][j - 1][k] && a[i][j][k] && a[i][j + 1][k]) ||
         (a[i][j][k - 1] && a[i][j][k] && a[i][j][k + 1]);
}
bool check(int i, int j, int k) {
  return (a[i][j][k] && a[i - 1][j][k] && a[i][j + 1][k] &&
          !a[i - 1][j + 1][k]) ||
         (a[i][j][k] && a[i + 1][j][k] && a[i][j - 1][k] &&
          !a[i + 1][j - 1][k]) ||
         (a[i][j][k] && a[i + 1][j][k] && a[i][j][k - 1] &&
          !a[i + 1][j][k - 1]) ||
         (a[i][j][k] && a[i - 1][j][k] && a[i][j][k + 1] &&
          !a[i - 1][j][k + 1]) ||
         (a[i][j][k] && a[i][j - 1][k] && a[i][j][k + 1] &&
          !a[i][j - 1][k + 1]) ||
         (a[i][j][k] && a[i][j + 1][k] && a[i][j][k - 1] &&
          !a[i][j + 1][k - 1]);
}
int main() {
  int n, m, p;
  cin >> n >> m >> p;
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= m; i++) {
      string s;
      cin >> s;
      for (int j = 1; j <= p; j++) {
        char ch = s[j - 1];
        a[i][j][k] = (ch == '1');
      }
    }
  }
  int ans = 0;
  for (int k = 1; k <= n; k++) {
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= p; j++) {
        int t = check(i, j, k) || check3(i, j, k);
        ans += t;
      }
    }
  }
  cout << ans;
  return 0;
}
