#include <bits/stdc++.h>
using namespace std;
char ss[505];
int a[505][505], str[505][505], s[505][505];
int main() {
  int n, m, i, j, k, K;
  while (~scanf("%d%d%d", &n, &m, &K)) {
    for (i = 1; i <= n; i++) {
      scanf("%s", ss);
      for (j = 1; j <= m; j++) a[i][j] = ss[j - 1] - '0';
    }
    memset(str, 0, sizeof(str));
    for (i = 2; i < n; i++)
      for (j = 2; j < m; j++)
        if (a[i][j] && a[i - 1][j] && a[i + 1][j] && a[i][j - 1] && a[i][j + 1])
          str[i][j] = 1;
    memset(s, 0, sizeof(s));
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++)
        s[i][j] = str[i][j] + s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1];
    long long res = 0;
    for (i = 3; i <= n; i++)
      for (j = 3; j <= m; j++) {
        int tmp = 1;
        for (k = j - 2; k >= 1; k--) {
          for (; tmp < i - 1 &&
                 s[i - 1][j - 1] - s[tmp][j - 1] - s[i - 1][k] + s[tmp][k] >= K;
               tmp++)
            ;
          res += (long long)tmp - 1;
        }
      }
    printf("%I64d\n", res);
  }
  return 0;
}
