#include <bits/stdc++.h>
using namespace std;
int N, M, K;
long long ANS;
int S[2505][2505], up[7], down[7];
int sum(int x1, int y1, int x2, int y2) {
  return S[x2][y2] - S[x1 - 1][y2] - S[x2][y1 - 1] + S[x1 - 1][y1 - 1];
}
void divide(int x1, int y1, int x2, int y2) {
  if (x1 == x2 && y1 == y2) return (void)(ANS += sum(x1, y1, x2, y2) == K);
  if (x2 - x1 + 1 > y2 - y1 + 1) {
    int mid = (x1 + x2) >> 1;
    for (int i = y1; i <= y2; i++) {
      for (int j = 0; j <= K; j++) up[j] = mid - x1 + 1, down[j] = x2 - mid;
      for (int j = i; j <= y2; j++) {
        for (int k = 0; k <= K; k++) {
          while (up[k] && sum(mid - up[k] + 1, i, mid, j) > k) up[k]--;
          while (down[k] && sum(mid + 1, i, mid + down[k] + 1 - 1, j) > k)
            down[k]--;
        }
        for (int k = 0; k <= K; k++)
          ANS += (up[k] - (k ? up[k - 1] : 0)) *
                 (down[K - k] - (K - k ? down[K - k - 1] : 0));
      }
    }
    divide(x1, y1, mid, y2);
    divide(mid + 1, y1, x2, y2);
  } else {
    int mid = (y1 + y2) >> 1;
    for (int i = x1; i <= x2; i++) {
      for (int j = 0; j <= K; j++) up[j] = mid - y1 + 1, down[j] = y2 - mid;
      for (int j = i; j <= x2; j++) {
        for (int k = 0; k <= K; k++) {
          while (up[k] && sum(i, mid - up[k] + 1, j, mid) > k) up[k]--;
          while (down[k] && sum(i, mid + 1, j, mid + down[k] + 1 - 1) > k)
            down[k]--;
        }
        for (int k = 0; k <= K; k++)
          ANS += (up[k] - (k ? up[k - 1] : 0)) *
                 (down[K - k] - (K - k ? down[K - k - 1] : 0));
      }
    }
    divide(x1, y1, x2, mid);
    divide(x1, mid + 1, x2, y2);
  }
}
int main() {
  char ch;
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= M; j++)
      scanf(" %c", &ch),
          S[i][j] = S[i - 1][j] + S[i][j - 1] - S[i - 1][j - 1] + (ch == '1');
  divide(1, 1, N, M);
  printf("%lld", ANS);
  return 0;
}
