#include <bits/stdc++.h>
bool Chkmax(int &x, int y) { return y > x ? x = y, true : false; }
bool Chkmin(int &x, int y) { return y < x ? x = y, true : false; }
const int MAXN = 3000 + 100, MAXK = 6 + 1;
int n, m, k;
long long ans;
int a[MAXN][MAXN], UpDown[MAXN][MAXN], LeftRight[MAXN][MAXN], sumv[MAXN][MAXN];
inline int GetSum(int xl, int xr, int yl, int yr) {
  return sumv[xr][yr] - sumv[xr][yl - 1] - sumv[xl - 1][yr] +
         sumv[xl - 1][yl - 1];
}
void Init() {
  char c;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1, _ = n; i <= _; i++)
    for (int j = 1, _ = m; j <= _; j++) {
      c = getchar();
      while (c != '0' && c != '1') c = getchar();
      a[i][j] = c - '0';
    }
  for (int i = 1, _ = n; i <= _; i++)
    for (int j = 1, _ = m; j <= _; j++) {
      LeftRight[i][j] = LeftRight[i][j - 1] + a[i][j];
      UpDown[i][j] = UpDown[i - 1][j] + a[i][j];
      sumv[i][j] = sumv[i - 1][j] + LeftRight[i][j];
    }
}
int sum1[MAXK], sum2[MAXK], tot1[MAXK], tot2[MAXK];
void WorkUpDown(int xl, int xr, int yl, int yr) {
  int M = (xl + xr) >> 1, sum, tot = 0;
  for (int L = yl, _ = yr; L <= _; L++) {
    for (int i = 0, _ = k; i <= _; i++) sum1[i] = sum2[i] = 0;
    for (int R = yr, _ = L; R >= _; R--) {
      for (int i = 0, _ = k; i <= _; i++) {
        while (M - sum1[i] >= xl && GetSum(M - sum1[i], M, L, R) <= i)
          sum1[i]++;
        while (M + 1 + sum2[i] <= xr &&
               GetSum(M + 1, M + 1 + sum2[i], L, R) <= i)
          sum2[i]++;
        tot1[i] = sum1[i];
        tot2[i] = sum2[i];
        if (i) {
          tot1[i] -= sum1[i - 1];
          tot2[i] -= sum2[i - 1];
        }
      }
      for (int i = 0, _ = k; i <= _; i++) {
        ans += tot1[i] * tot2[k - i];
        tot += tot1[i] * tot2[k - i];
      }
    }
  }
}
void WorkLeftRight(int xl, int xr, int yl, int yr) {
  int M = (yl + yr) >> 1, i, tot = 0;
  for (int L = xl, _ = xr; L <= _; L++) {
    for (int i = 0, _ = k; i <= _; i++) sum1[i] = sum2[i] = 0;
    for (int R = xr, _ = L; R >= _; R--) {
      for (int i = 0, _ = k; i <= _; i++) {
        while (M - sum1[i] >= yl && GetSum(L, R, M - sum1[i], M) <= i)
          sum1[i]++;
        while (M + 1 + sum2[i] <= yr &&
               GetSum(L, R, M + 1, M + 1 + sum2[i]) <= i)
          sum2[i]++;
        tot1[i] = sum1[i];
        tot2[i] = sum2[i];
        if (i) {
          tot1[i] -= sum1[i - 1];
          tot2[i] -= sum2[i - 1];
        }
      }
      for (int i = 0, _ = k; i <= _; i++) {
        ans += tot1[i] * tot2[k - i];
        tot += tot1[i] * tot2[k - i];
      }
    }
  }
}
void Work(int xl, int xr, int yl, int yr) {
  if (xl == xr && yl == yr) {
    ans += (a[xl][yl] == k);
    return;
  }
  if (xr - xl >= yr - yl) {
    Work(xl, (xl + xr) >> 1, yl, yr);
    Work(((xl + xr) >> 1) + 1, xr, yl, yr);
    WorkUpDown(xl, xr, yl, yr);
  } else {
    Work(xl, xr, yl, (yl + yr) >> 1);
    Work(xl, xr, ((yl + yr) >> 1) + 1, yr);
    WorkLeftRight(xl, xr, yl, yr);
  }
}
int main() {
  Init();
  Work(1, n, 1, m);
  printf("%I64d\n", ans);
}
