#include <bits/stdc++.h>
int n, m, k;
char s[2505][2505];
long long a[2505][2505];
inline long long sum(int r1, int c1, int r2, int c2) {
  return a[r2][c2] - a[r1 - 1][c2] - a[r2][c1 - 1] + a[r1 - 1][c1 - 1];
}
inline long long go(int r1, int c1, int r2, int c2) {
  if (r1 == r2 && c1 == c2) return sum(r1, c1, r2, c2) == k;
  if (r2 - r1 > c2 - c1) {
    long long cnt = 0;
    int m = r1 + r2 >> 1;
    int up[k + 1], dw[k + 1];
    for (int i = c1; i <= c2; i++) {
      for (int x = 0; x <= k; x++) up[x] = m - r1 + 1, dw[x] = r2 - m;
      for (int j = i; j <= c2; j++) {
        for (int x = 0; x <= k; x++) {
          while (up[x] && sum(m - up[x] + 1, i, m, j) > x) up[x]--;
          while (dw[x] && sum(m + 1, i, m + dw[x], j) > x) dw[x]--;
        }
        for (int x = 0; x <= k; x++) {
          cnt += (long long)(up[x] - (x ? up[x - 1] : 0)) *
                 (dw[k - x] - (k - x ? dw[k - x - 1] : 0));
        }
      }
    }
    return cnt + go(r1, c1, m, c2) + go(m + 1, c1, r2, c2);
  } else {
    long long cnt = 0;
    int m = c1 + c2 >> 1;
    int up[k + 1], dw[k + 1];
    for (int i = r1; i <= r2; i++) {
      for (int x = 0; x <= k; x++) up[x] = m - c1 + 1, dw[x] = c2 - m;
      for (int j = i; j <= r2; j++) {
        for (int x = 0; x <= k; x++) {
          while (up[x] && sum(i, m - up[x] + 1, j, m) > x) up[x]--;
          while (dw[x] && sum(i, m + 1, j, m + dw[x]) > x) dw[x]--;
        }
        for (int x = 0; x <= k; x++) {
          cnt += (long long)(up[x] - (x ? up[x - 1] : 0)) *
                 (dw[k - x] - (k - x ? dw[k - x - 1] : 0));
        }
      }
    }
    return cnt + go(r1, c1, r2, m) + go(r1, m + 1, r2, c2);
  }
}
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++) {
      a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + s[i][j] - '0';
    }
  }
  printf("%I64d\n", go(1, 1, n, m));
}
