#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, t, a[501][501], r[501][501], c[501][501], cnt;
long long ans;
char cc[501][501];
int main() {
  scanf("%d%d%d\n", &n, &m, &t);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) scanf("%c", &cc[i][j]);
    scanf("\n");
  }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (cc[i][j] == '1') {
        r[i][j] = 1 + r[i][j - 1];
        c[i][j] = 1 + c[i - 1][j];
      }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (r[i - 1][j] > 2 && c[i][j - 1] > 2)
        a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + 1;
      else
        a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1];
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      for (k = i + 2; k <= n; k++) {
        int l = j + 2, r = m, mid;
        while (l <= r) {
          mid = (l + r) / 2;
          cnt = a[k][mid] - a[i + 1][mid] - (a[k][j + 1] - a[i + 1][j + 1]);
          if (cnt >= t)
            r = mid - 1;
          else
            l = mid + 1;
        }
        ans += (m - r);
      }
    }
  cout << ans;
  return 0;
}
