#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int m, n, p;
char mat[N][N];
int col[N];
int c[N][N];
int main() {
  scanf("%d%d%d", &m, &n, &p);
  for (int i = 1; i <= m; i++) scanf("%s", mat[i] + 1);
  for (int i = 1; i <= m; i++)
    for (int j = 1; j <= n; j++)
      c[i][j] =
          (mat[i][j] == '1' && mat[i - 1][j] == '1' && mat[i][j - 1] == '1' &&
           mat[i + 1][j] == '1' && mat[i][j + 1] == '1');
  long long ans = 0;
  for (int i = 1; i <= m; i++)
    for (int j = i + 2; j <= m; j++) {
      if (j == i + 2) {
        for (int k = 0; k <= n; k++) col[k] = 0;
      }
      for (int k = 1; k <= n; k++) col[k] += c[j - 1][k];
      int Sum = 0;
      int l = 1;
      for (int r = 3; r <= n; r++) {
        Sum += col[r - 1];
        while (l + 2 < r && Sum - col[l + 1] >= p) {
          Sum -= col[l + 1];
          l++;
        }
        if (Sum >= p) ans += l;
      }
    }
  printf("%I64d\n", ans);
}
