#include <bits/stdc++.h>
using namespace std;
long long n, m, k, Free[569][569], sums[569][569], star[569][569], pre, ans;
string s;
long long cal(long long y1, long long y2, long long x) {
  return sums[x][y1] - sums[x][y2 - 1];
}
int main() {
  scanf("%lld%lld%lld", &m, &n, &k);
  for (long long i = 1; i <= m; i++) {
    cin >> s;
    for (long long j = 1; j <= n; j++) {
      if (s[j - 1] == '1') Free[j][i] = 1;
    }
  }
  for (long long j = 1; j <= m; j++) {
    for (long long i = 1; i <= n; i++) {
      if (Free[i + 1][j] && Free[i - 1][j] && Free[i][j + 1] &&
          Free[i][j - 1] && Free[i][j]) {
        star[i][j] = 1;
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= m; j++) {
      sums[i][j] = sums[i][j - 1] + star[i][j];
    }
  }
  long long sum;
  for (long long i1 = 2; i1 <= m - 1; i1++) {
    for (long long i2 = 2; i2 <= i1; i2++) {
      pre = 2;
      sum = 0;
      for (long long j = 2; j <= n - 1; j++) {
        sum += cal(i1, i2, j);
        while (sum - cal(i1, i2, pre) >= k && pre < j)
          sum -= cal(i1, i2, pre), pre++;
        if (sum >= k) ans += (pre - 1);
      }
    }
  }
  cout << ans;
}
