#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64777216")
using namespace std;
const long long maxn = 102;
const long long maxq = 1000001;
const long long maxseg = 262144;
const long long secret_number = -87468267;
const pair<int, int> secret_pair = make_pair(secret_number, secret_number);
const long long inf = 1e18;
const long long mod = 87178291199;
const int iinf = 2147483647 / 2;
const double pi = 3.141592653589793238462643383279502884;
const double eps = 1e-7;
const string something_very_long =
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
    "aaaaaaaa";
const string govno = "g";
struct node {
  int x, y, z;
  node(int xx, int yy, int zz) {
    x = xx;
    y = yy;
    z = zz;
  }
};
queue<node> q;
int dx[] = {1, 0, 0};
int dy[] = {0, 1, 0};
int dz[] = {0, 0, 1};
bool used[maxn][maxn][maxn];
char a[maxn][maxn][maxn];
void smallbfs(int xc, int yc, int zc, int x, int y, int z) {
  for (int i = -1; i <= 1; ++i)
    for (int j = -1; j <= 1; ++j)
      for (int k = -1; k <= 1; ++k) used[x + i][y + j][z + k] = false;
  used[x][y][z] = true;
  used[xc][yc][zc] = true;
  q.push(node(xc, yc, zc));
  int cur = 0;
  while (!q.empty()) {
    node cur = q.front();
    q.pop();
    for (int i = 0; i < 3; ++i) {
      node to = node(cur.x + dx[i], cur.y + dy[i], cur.z + dz[i]);
      if (used[to.x][to.y][to.z]) continue;
      if (a[to.x][to.y][to.z] == '0') continue;
      if (abs(to.x - x) > 1 || abs(to.y - y) > 1 || abs(to.z - z) > 1) continue;
      used[to.x][to.y][to.z] = true;
      q.push(to);
    }
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i <= n + 1; ++i)
    for (int j = 0; j <= m + 1; ++j)
      for (int s = 0; s < k + 1; ++s) a[i][j][s] = '0';
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      for (int s = 1; s <= k; ++s) cin >> a[i][j][s];
  long long ans = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      for (int s = 1; s <= k; ++s) {
        if (a[i][j][s] == '0') continue;
        int x, y, z;
        bool g;
        for (int t = -1; t <= 1; ++t) {
          if (t == 0) continue;
          int x, y, z;
          g = false;
          for (int q = 0; q < 3; ++q) {
            x = i + dx[q] * t;
            y = j + dy[q] * t;
            z = s + dz[q] * t;
            if (a[x][y][z] == '1') {
              if (t < 0) {
                smallbfs(x, y, z, i, j, s);
                for (int h = 0; h < 3; ++h)
                  if ((a[i + dx[h]][j + dy[h]][s + dz[h]] == '1') &&
                      (!used[i + dx[h]][j + dy[h]][s + dz[h]]))
                    g = true;
              }
            }
          }
          if (g) {
            ans++;
            break;
          }
        }
      }
  cout << ans;
  return 0;
}
