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