#include <bits/stdc++.h>
using namespace std;
char a[600][600];
int c[600][600], b[600][600], s[600][600];
int main() {
  long long ans = 0;
  int n, m, k;
  scanf("%d%d%d\n", &n, &m, &k);
  for (int i = 0; i < n; i++) gets(a[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] == '1')
        c[i][j] = 1;
      else
        c[i][j] = 0;
  for (int i = 1; i < n - 1; i++)
    for (int j = 1; j < m - 1; j++)
      if (c[i][j] + c[i - 1][j] + c[i + 1][j] + c[i][j - 1] + c[i][j + 1] == 5)
        b[i][j] = 1;
  for (int i = 1; i < n; i++)
    for (int j = 1; j < m; j++)
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + b[i][j];
  for (int i = 1; i < n - 1; i++)
    for (int j = i; j < n - 1; j++) {
      int l = 1, r = 1;
      while (r < m - 1) {
        if (s[j][r] - s[i - 1][r] - s[j][l - 1] + s[i - 1][l - 1] >= k) {
          ans += (m - r - 1);
          l++;
        } else
          r++;
      }
    }
  printf("%I64d", ans);
  return 0;
}
