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