#include <bits/stdc++.h>
using namespace std;
const int KMAX = 8;
const int NMAX = 2505;
char mat[NMAX][NMAX];
int psm[NMAX][NMAX], pt1[KMAX], pt2[KMAX];
inline int sum(int x1, int y1, int x2, int y2) {
  return psm[x2][y2] - psm[x2][y1 - 1] - psm[x1 - 1][y2] + psm[x1 - 1][y1 - 1];
}
long long solve(int x1, int y1, int x2, int y2, int k) {
  if (x1 == x2 and y1 == y2) return sum(x1, y1, x2, y2) == k;
  long long ans;
  if (x2 - x1 <= y2 - y1) {
    int ym = (y1 + y2) / 2;
    ans = solve(x1, y1, x2, ym, k) + solve(x1, ym + 1, x2, y2, k);
    for (int i = x1; i <= x2; ++i) {
      for (int k1 = 0; k1 <= k; ++k1) pt1[k1] = y1, pt2[k1] = y2;
      for (int j = i; j <= x2; ++j) {
        for (int k1 = 0; k1 <= k; ++k1) {
          while (pt1[k1] <= ym and sum(i, pt1[k1], j, ym) > k1) ++pt1[k1];
          while (pt2[k1] > ym and sum(i, ym + 1, j, pt2[k1]) > k1) --pt2[k1];
        }
        for (int k1 = 0; k1 <= k; ++k1)
          ans += 1LL * (((k1 > 0) ? pt1[k1 - 1] : (ym + 1)) - pt1[k1]) *
                 (pt2[k - k1] - ((k - k1 > 0) ? pt2[k - k1 - 1] : ym));
      }
    }
  } else {
    int xm = (x1 + x2) / 2;
    ans = solve(x1, y1, xm, y2, k) + solve(xm + 1, y1, x2, y2, k);
    for (int i = y1; i <= y2; ++i) {
      for (int k1 = 0; k1 <= k; ++k1) pt1[k1] = x1, pt2[k1] = x2;
      for (int j = i; j <= y2; ++j) {
        for (int k1 = 0; k1 <= k; ++k1) {
          while (pt1[k1] <= xm and sum(pt1[k1], i, xm, j) > k1) ++pt1[k1];
          while (pt2[k1] > xm and sum(xm + 1, i, pt2[k1], j) > k1) --pt2[k1];
        }
        for (int k1 = 0; k1 <= k; ++k1)
          ans += 1LL * (((k1 > 0) ? pt1[k1 - 1] : (xm + 1)) - pt1[k1]) *
                 (pt2[k - k1] - ((k - k1 > 0) ? pt2[k - k1 - 1] : xm));
      }
    }
  }
  return ans;
}
int main(void) {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", mat[i] + 1);
    for (int j = 1; j <= m; ++j)
      psm[i][j] =
          psm[i - 1][j] + psm[i][j - 1] - psm[i - 1][j - 1] + (mat[i][j] - '0');
  }
  printf("%I64d\n", solve(1, 1, n, m, k));
  return 0;
}
