#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int N = 100001;
template <typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
  out << a.first << " " << a.second;
  return out;
}
template <typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
  in >> a.first >> a.second;
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<pair<T, T> > a) {
  for (int i = 0; i < a.size(); ++i) out << a[i] << endl;
  return out;
}
template <typename T>
istream& operator>>(istream& in, vector<T>& a) {
  for (int i = 0; i < a.size(); ++i) in >> a[i];
  return in;
}
template <typename T>
ostream& operator<<(ostream& out, vector<T> a) {
  for (int i = 0; i < a.size(); ++i)
    if (i == a.size() - 1)
      out << a[i];
    else
      out << a[i] << " ";
  return out;
}
bool c[110][110][110];
bool used[110][110][110];
int main() {
  ios_base::sync_with_stdio(0);
  int h, n, m;
  cin >> h >> n >> m;
  for (int z = 0; z <= h + 1; z++)
    for (int i = 0; i <= n; i++)
      for (int j = 0; j <= m; j++) c[z][i][j] = 0;
  for (int z = 1; z <= h; z++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        char x;
        cin >> x;
        c[z][i][j] = (x == '1');
      }
  int ans = 0;
  for (int k = 1; k <= h; k++)
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        if (!c[k][i][j]) continue;
        bool f = false;
        if (c[k - 1][i][j] && c[k][i + 1][j] && !c[k - 1][i + 1][j]) f = 1;
        if (c[k - 1][i][j] && c[k][i][j + 1] && !c[k - 1][i][j + 1]) f = 1;
        if (c[k + 1][i][j] && c[k][i - 1][j] && !c[k + 1][i - 1][j]) f = 1;
        if (c[k + 1][i][j] && c[k][i][j - 1] && !c[k + 1][i][j - 1]) f = 1;
        if (c[k][i - 1][j] && c[k][i][j + 1] && !c[k][i - 1][j + 1]) f = 1;
        if (c[k][i][j - 1] && c[k][i + 1][j] && !c[k][i + 1][j - 1]) f = 1;
        if (c[k][i][j + 1] && c[k][i][j - 1]) f = 1;
        if (c[k][i - 1][j] && c[k][i + 1][j]) f = 1;
        if (c[k + 1][i][j] && c[k - 1][i][j]) f = 1;
        ans += f;
      }
  cout << ans << endl;
  if (0)
    cerr << fixed << setprecision(0)
         << "TIME = " << clock() / (long double)CLOCKS_PER_SEC * 1000 << "\n";
  return 0;
}
