#include <bits/stdc++.h>
using namespace std;
int a[3010][3010];
char st[3010];
int n, m, k;
long long ans;
int t[11], d[11];
int calc(int xl, int xr, int yl, int yr, int cas) {
  if (cas) swap(xl, yl), swap(xr, yr);
  return a[xr][yr] - a[xl - 1][yr] - a[xr][yl - 1] + a[xl - 1][yl - 1];
}
void solve(int xl, int xr, int yl, int yr, int cas) {
  if (xl > xr || yl > yr) return;
  if (yr - yl > xr - xl) swap(xl, yl), swap(xr, yr), cas ^= 1;
  int mid = (xl + xr) >> 1;
  for (int i = yl; i <= yr; i++) {
    for (int j = 0; j <= k; j++) t[j] = xl, d[j] = xr;
    for (int j = i; j <= yr; j++) {
      for (int w = 0; w <= k; w++) {
        while (calc(t[w], mid, i, j, cas) > w) t[w]++;
        while (calc(mid + 1, d[w], i, j, cas) > w) d[w]--;
      }
      for (int w = 0; w <= k; w++)
        ans += 1ll * (-t[w] + (w ? t[w - 1] : mid + 1)) *
               (d[k - w] - (k - w ? d[k - w - 1] : mid - 1));
    }
  }
  solve(xl, mid - 1, yl, yr, cas), solve(mid + 1, xr, yl, yr, cas);
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%s", st + 1);
    for (int j = 1; j <= m; j++)
      a[i][j] = a[i - 1][j] + a[i][j - 1] - a[i - 1][j - 1] + st[j] - '0';
  }
  solve(1, n, 1, m, 0);
  printf("%lld\n", ans);
}
