#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2510;
long long ans = 0;
int n, m, k, sum[MAXN][MAXN], a[MAXN][MAXN];
inline int suma(int i, int j) {
  if (i < 0 || j < 0) return 0;
  return sum[i][j];
}
int get(int x1, int y1, int x2, int y2) {
  if (x1 > x2) swap(x1, x2);
  if (y1 > y2) swap(y1, y2);
  return suma(y2, x2) + suma(y1 - 1, x1 - 1) - suma(y1 - 1, x2) -
         suma(y2, x1 - 1);
}
inline void kraj(int y1, int x1, int y2, int x2, int f) {
  if (!f) {
    int j = x1, broj1 = 0, ii = x1, broj2 = 0;
    for (int i = x1; i < x2; ++i) {
      if (i && a[y1][i - 1] == 1) --broj1, --broj2;
      if (j <= i) j = i + 1, broj1 = a[y1][i];
      if (ii <= i) ii = i + 1, broj2 = a[y1][i];
      while (j < x2 && broj1 < k) {
        broj1 += a[y1][j];
        ++j;
      }
      while (ii < x2 && broj2 <= k) {
        broj2 += a[y1][ii];
        ++ii;
      }
      ans += ii - j;
      if (ii == x2 && broj2 <= k && broj1 == k) ++ans;
    }
  } else {
    int j = y1, broj1 = 0, ii = y1, broj2 = 0;
    for (int i = y1; i < y2; ++i) {
      if (i && a[i - 1][x1] == 1) --broj1, --broj2;
      if (j <= i) j = i + 1, broj1 = a[i][x1];
      if (ii <= i) ii = i + 1, broj2 = a[i][x1];
      while (j < y2 && broj1 < k) {
        broj1 += a[j][x1];
        ++j;
      }
      while (ii < y2 && broj2 <= k) {
        broj2 += a[ii][x1];
        ++ii;
      }
      ans += ii - j;
      if (ii == y2 && broj2 <= k && broj1 == k) ++ans;
    }
  }
}
int gore[10], dole[10], ggore[10], ddole[10];
void solve1(int y1, int x1, int y2, int x2) {
  int mid = (y1 + y2) / 2;
  for (int i = x1; i < x2; ++i) {
    for (int j = 0; j <= k; ++j) ggore[j] = y1, ddole[j] = y2 - 1;
    for (int j = i; j < x2; ++j) {
      for (int ii = 0; ii <= k; ++ii) {
        while (ggore[ii] < mid && get(i, mid - 1, j, ggore[ii]) > ii)
          ++ggore[ii];
        while (ddole[ii] >= mid && get(i, mid, j, ddole[ii]) > ii) --ddole[ii];
      }
      for (int ii = 0; ii <= k; ++ii)
        gore[ii] = ggore[ii], dole[ii] = ddole[ii];
      for (int ii = k; ii > 0; --ii)
        gore[ii] = gore[ii - 1] - gore[ii], dole[ii] -= dole[ii - 1];
      gore[0] = mid - gore[0], dole[0] -= mid - 1;
      for (int ii = 0; ii <= k; ++ii) {
      }
      for (int ii = 0; ii <= k; ++ii) ans += gore[ii] * dole[k - ii];
    }
  }
}
void solve2(int y1, int x1, int y2, int x2) {
  int mid = (x1 + x2) / 2;
  for (int i = y1; i < y2; ++i) {
    for (int j = 0; j <= k; ++j) ggore[j] = x1, ddole[j] = x2 - 1;
    for (int j = i; j < y2; ++j) {
      for (int ii = 0; ii <= k; ++ii) {
        while (ggore[ii] < mid && get(mid - 1, j, ggore[ii], i) > ii)
          ++ggore[ii];
        while (ddole[ii] >= mid && get(mid, j, ddole[ii], i) > ii) --ddole[ii];
      }
      for (int ii = 0; ii <= k; ++ii)
        gore[ii] = ggore[ii], dole[ii] = ddole[ii];
      for (int ii = k; ii > 0; --ii)
        gore[ii] = gore[ii - 1] - gore[ii], dole[ii] -= dole[ii - 1];
      gore[0] = mid - gore[0], dole[0] -= mid - 1;
      for (int ii = 0; ii <= k; ++ii) ans += gore[ii] * dole[k - ii];
    }
  }
}
void rek(int y1, int x1, int y2, int x2, int f) {
  if (y1 == y2 || x1 == x2) return;
  if ((!f && y1 + 1 == y2) || (f && x1 + 1 == x2)) {
    kraj(y1, x1, y2, x2, f);
    return;
  }
  if (!f) {
    solve1(y1, x1, y2, x2);
    int mid = (y1 + y2) / 2;
    rek(y1, x1, mid, x2, 1);
    rek(mid, x1, y2, x2, 1);
  } else {
    solve2(y1, x1, y2, x2);
    int mid = (x1 + x2) / 2;
    rek(y1, x1, y2, mid, 0);
    rek(y1, mid, y2, x2, 0);
  }
}
char _buff[10000000];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  fread(_buff, 1, 3000 * 3000, stdin);
  char *p = _buff;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      while (*p != '0' && *p != '1') ++p;
      a[i][j] = *p - '0';
      ++p;
    }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      sum[i][j] =
          suma(i - 1, j) + suma(i, j - 1) - suma(i - 1, j - 1) + a[i][j];
  rek(0, 0, n, m, 0);
  printf("%I64d\n", ans);
  return 0;
}
