#include <bits/stdc++.h>
using namespace std;
const double eps = 1E-9;
const double Exp = 2.718281828459045;
const double pi = 3.14159;
const double E = 2.7182818284590452354;
const int Max_Bit = 63;
const int INF = 2000000000;
const long long LINF = 1000000000000000007ll;
const int MOD = 1000000007;
const int NMAX = 105;
const int MMAX = 1005;
const int base = 1000 * 1000 * 1000;
int n, m, k, a[NMAX][NMAX][NMAX];
int ok(int i, int j, int l) {
  bool flag = false;
  if (a[i][j][l] == 1) {
    if (i < n && a[i + 1][j][l] == 1 &&
        ((i > 1 && a[i - 1][j][l] == 1) ||
         (j > 1 && a[i][j - 1][l] == 1 && a[i + 1][j - 1][l] == 0) ||
         (l > 1 && a[i][j][l - 1] == 1 && a[i + 1][j][l - 1] == 0)))
      flag = true;
    if (j < m && a[i][j + 1][l] == 1 &&
        ((j > 1 && a[i][j - 1][l] == 1) ||
         (i > 1 && a[i - 1][j][l] == 1 && a[i - 1][j + 1][l] == 0) ||
         (l > 1 && a[i][j][l - 1] == 1 && a[i][j + 1][l - 1] == 0)))
      flag = true;
    if (l < k && a[i][j][l + 1] == 1 &&
        ((l > 1 && a[i][j][l - 1] == 1) ||
         (i > 1 && a[i - 1][j][l] == 1 && a[i - 1][j][l + 1] == 0) ||
         (j > 1 && a[i][j - 1][l] == 1 && a[i][j - 1][l + 1] == 0)))
      flag = true;
  }
  if (flag) return 1;
  return 0;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      string second;
      cin >> second;
      for (int l = 1; l <= k; l++) a[i][j][l] = int(second[l - 1] - '0');
    }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int l = 1; l <= k; l++) ans += ok(i, j, l);
  printf("%d\n", ans);
  return 0;
}
