#include <bits/stdc++.h>
using namespace std;
const int MAXN = 505;
int star[MAXN][MAXN], a[MAXN], sum[MAXN], n, m, K;
string s[MAXN];
int dx[] = {1, 0, 1, 2, 1}, dy[] = {0, 1, 1, 1, 2};
int get() {
  int l = 0, r = 0;
  int ret = 0;
  while (l <= r && r <= n) {
    if (a[r] - a[l] < K) {
      r++;
    } else {
      ret += n - r + 1;
      l++;
    }
  }
  return ret;
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  if (n < 3 || m < 3) {
    return 0 * printf("0");
  }
  n -= 2;
  m -= 2;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      star[i][j] = 1;
      for (int k = 0; k < 5; k++) {
        if (s[i + dx[k]][j + dy[k]] == '0') star[i][j] = 0;
      }
    }
  }
  long long ans = 0;
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) sum[i] = 0;
    for (int k = j; k < m; k++) {
      for (int i = 0; i < n; i++) {
        if (star[i][k]) sum[i]++;
      }
      for (int i = 0; i < n; i++) {
        a[i + 1] = a[i] + sum[i];
      }
      ans += get();
    }
  }
  cout << ans << endl;
  return 0;
}
