#include <bits/stdc++.h>
using namespace std;
const int N = 2505;
int n, m, k, a[2][N][N], u[7][N], d[7][N];
long long ans = 0;
char ch[N];
void solve(int x1, int y1, int x2, int y2, int dir) {
  if (x2 - x1 < y2 - y1) {
    swap(x1, y1), swap(x2, y2);
    dir ^= 1;
  }
  int(*c)[N] = a[dir], (*opp)[N] = a[!dir], mid = (x1 + x2) >> 1;
  if (x1 == x2) {
    ans += (c[x1][y1] - c[x1][y1 - 1] == k);
    return;
  }
  int pu[7], pd[7], cu[7], cd[7], cur;
  for (int l = y1; l <= y2; ++l) {
    for (int ck = 0; ck <= k; ++ck)
      pu[ck] = x1, pd[ck] = x2, cu[ck] = cd[ck] = 0;
    for (int r = l; r <= y2; ++r) {
      for (int ck = 0; ck <= k; ++ck) {
        int &p1 = pu[ck], &c1 = cu[ck];
        c1 += opp[r][mid - 1] - opp[r][p1 - 1];
        for (; c1 > ck; c1 -= c[p1][r] - c[p1][l - 1], ++p1)
          ;
        int &p2 = pd[ck], &c2 = cd[ck];
        c2 += opp[r][p2] - opp[r][mid];
        for (; c2 > ck; c2 -= c[p2][r] - c[p2][l - 1], --p2)
          ;
      }
      cur = k - (c[mid][r] - c[mid][l - 1]);
      if (cur < 0) break;
      for (int ck = 0; ck <= cur; ++ck)
        ans += ((ck ? pu[ck - 1] : mid + 1) - pu[ck]) *
               (pd[cur - ck] - (cur - ck ? pd[cur - ck - 1] : mid - 1));
    }
  }
  if (x1 < mid) solve(x1, y1, mid - 1, y2, dir);
  if (mid < x2) solve(mid + 1, y1, x2, y2, dir);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", ch + 1);
    for (int j = 1; j <= m; ++j) a[0][i][j] = a[1][j][i] = ch[j] - '0';
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) a[0][i][j] += a[0][i][j - 1];
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= n; ++j) a[1][i][j] += a[1][i][j - 1];
  solve(1, 1, n, m, 0);
  printf("%I64d\n", ans);
  return 0;
}
