#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int n, m, K;
long long ans = 0;
char s[2505][2505];
int sum[2505][2505], p1[20005], p2[20005];
int calc(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] - sum[x2][y1 - 1] - sum[x1 - 1][y2] + sum[x1 - 1][y1 - 1];
}
void solve(int x1, int y1, int x2, int y2, int horver) {
  if (x1 > x2 || y1 > y2) return;
  if (x1 == x2 && y1 == y2) {
    ans += (calc(x1, y1, x2, y2) == K);
    return;
  }
  if (horver == 1) {
    int mid = x1 + x2 >> 1;
    solve(x1, y1, mid, y2, horver ^ 1);
    solve(mid + 1, y1, x2, y2, horver ^ 1);
    for (int i = y1; i <= y2; i++) {
      for (int k = 0; k <= K; k++) {
        p1[k] = mid, p2[k] = mid + 1;
      }
      for (int j = y2; j >= i; j--) {
        for (int k = 0; k <= K; k++) {
          while (p1[k] >= x1 && calc(p1[k], i, mid, j) <= k) --p1[k];
          while (p2[k] <= x2 && calc(mid + 1, i, p2[k], j) <= k) ++p2[k];
        }
        for (int k = 1; k < K; k++) {
          ans += (p1[k - 1] - p1[k]) * (p2[K - k] - p2[K - k - 1]);
        }
        if (K > 0) {
          ans += (mid - p1[0]) * (p2[K] - p2[K - 1]);
          ans += (p2[0] - mid - 1) * (p1[K - 1] - p1[K]);
        } else if (K == 0) {
          ans += (mid - p1[0]) * (p2[0] - mid - 1);
        }
      }
    }
  } else {
    int mid = y1 + y2 >> 1;
    solve(x1, y1, x2, mid, horver ^ 1);
    solve(x1, mid + 1, x2, y2, horver ^ 1);
    for (int i = x1; i <= x2; i++) {
      for (int k = 0; k <= K; k++) {
        p1[k] = mid, p2[k] = mid + 1;
      }
      for (int j = x2; j >= i; j--) {
        for (int k = 0; k <= K; k++) {
          while (p1[k] >= y1 && calc(i, p1[k], j, mid) <= k) --p1[k];
          while (p2[k] <= y2 && calc(i, mid + 1, j, p2[k]) <= k) ++p2[k];
        }
        for (int k = 1; k < K; k++) {
          ans += (p1[k - 1] - p1[k]) * (p2[K - k] - p2[K - k - 1]);
        }
        if (K > 0) {
          ans += (mid - p1[0]) * (p2[K] - p2[K - 1]);
          ans += (p2[0] - mid - 1) * (p1[K - 1] - p1[K]);
        } else if (K == 0) {
          ans += (mid - p1[0]) * (p2[0] - mid - 1);
        }
      }
    }
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      sum[i][j] =
          sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + (s[i][j] == '1');
  solve(1, 1, n, m, 0);
  printf("%I64d\n", ans);
  return 0;
}
