#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[2510][2510], b[2510][2510];
int L[2510][10], R[2510][10], ql[10], qr[10], tmp[10], fl[10], fr[10];
long long ans;
char s[2510];
void Solve(int u, int d, int l, int r) {
  if (d < u || r < l) return;
  bool flag;
  int t;
  if (r - l > d - u) {
    for (int i = u; i <= d; ++i)
      for (int j = l; j <= r; ++j) b[i][j] = a[i][j];
    flag = 0;
  } else {
    swap(u, l);
    swap(d, r);
    for (int i = u; i <= d; ++i)
      for (int j = l; j <= r; ++j) b[i][j] = a[j][i];
    flag = 1;
  }
  int mid = (l + r) >> 1;
  for (int i = u; i <= d; ++i) {
    for (int j = 1; j <= k + 1; ++j) L[i][j] = l - 1, R[i][j] = r + 1;
    t = 0;
    for (int j = mid; j >= l; --j)
      if (b[i][j]) {
        L[i][++t] = j;
        if (t == k + 1) break;
      }
    t = 0;
    for (int j = mid; j <= r; ++j)
      if (b[i][j]) {
        R[i][++t] = j;
        if (t == k + 1) break;
      }
  }
  for (int i = u; i <= d; ++i) {
    int s = 0;
    for (int j = 1; j <= k + 1; ++j) ql[j] = l - 1, qr[j] = r + 1;
    for (int j = i; j <= d; ++j) {
      s += b[j][mid];
      if (s > k) break;
      for (int p = 1; p <= k + 1; ++p) tmp[p] = ql[p];
      for (int x = 1, y = 1; x - 1 + y - 1 < k + 1;) {
        if (tmp[x] > L[j][y])
          ql[x - 1 + y - 1 + 1] = tmp[x], ++x;
        else
          ql[x - 1 + y - 1 + 1] = L[j][y], ++y;
      }
      for (int p = 1; p <= k + 1; ++p) tmp[p] = qr[p];
      for (int x = 1, y = 1; x - 1 + y - 1 < k + 1;) {
        if (tmp[x] < R[j][y])
          qr[x - 1 + y - 1 + 1] = tmp[x], ++x;
        else
          qr[x - 1 + y - 1 + 1] = R[j][y], ++y;
      }
      for (int p = 0; p <= k; ++p) fl[p] = fr[p] = 0;
      for (int x = 0, y = mid, xx = 0, p = 1; p <= k + 1; ++p) {
        ++xx;
        if (p == k + 1 || ql[p] != ql[p + 1]) {
          fl[x] = y - ql[p];
          x = xx;
          y = ql[p];
        }
      }
      for (int x = 0, y = mid, xx = 0, p = 1; p <= k + 1; ++p) {
        ++xx;
        if (p == k + 1 || qr[p] != qr[p + 1]) {
          fr[x] = qr[p] - y;
          x = xx;
          y = qr[p];
        }
      }
      for (int p = s; p <= k; ++p) ans += (long long)fl[p] * fr[k + s - p];
    }
  }
  if (flag == 0) {
    Solve(u, d, l, mid - 1);
    Solve(u, d, mid + 1, r);
  } else {
    swap(u, l);
    swap(d, r);
    Solve(u, mid - 1, l, r);
    Solve(mid + 1, d, l, r);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s + 1);
    for (int j = 1; j <= m; ++j) a[i][j] = s[j] - '0';
  }
  Solve(1, n, 1, m);
  printf("%I64d\n", ans);
  return 0;
}
