#include <bits/stdc++.h>
using namespace std;
const int maxn = 2510;
int sum[maxn][maxn];
char s[maxn][maxn];
int n, m, K;
long long ans;
int p1[10], p2[10];
int cal(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1];
}
void div(int x1, int y1, int x2, int y2, bool flag) {
  if (x1 > x2 || y1 > y2) return;
  if (x1 == x2 && y1 == y2) {
    ans += (cal(x1, y1, x2, y2) == K);
    return;
  }
  if (flag) {
    int mid = (x1 + x2) >> 1;
    div(x1, y1, mid, y2, !flag);
    div(mid + 1, y1, x2, y2, !flag);
    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 && cal(p1[k], i, mid, j) <= k) p1[k]--;
          while (p2[k] <= x2 && cal(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;
    div(x1, y1, x2, mid, !flag);
    div(x1, mid + 1, x2, y2, !flag);
    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 && cal(i, p1[k], j, mid) <= k) p1[k]--;
          while (p2[k] <= y2 && cal(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');
    }
  div(1, 1, n, m, 0);
  printf("%lld\n", ans);
}
