#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
int k;
const int maxn = 2500, maxk = 6;
int table[maxn][maxn];
inline int getValue(int type, int x, int y) {
  if (type) swap(x, y);
  return table[y][x];
}
int a[maxn][2][maxk + 1];
long long solve(int y1, int y2, int x1, int x2) {
  int type = (y2 - y1) < (x2 - x1) ? 0 : 1;
  int xs[2][2] = {{x1, x2}, {y1, y2}};
  if (type) swap(xs[0][0], xs[1][0]), swap(xs[0][1], xs[1][1]);
  if (xs[1][1] - xs[1][0] == 1) {
    long long ans = 0;
    for (int l = xs[0][0]; l < xs[0][1]; ++l) {
      int sum = 0;
      for (int r = l; r < xs[0][1]; ++r) {
        if (getValue(type, r, xs[1][0])) ++sum;
        if (sum > k) break;
        if (sum == k) ++ans;
      }
    }
    return ans;
  }
  int midx = (xs[0][1] + xs[0][0]) / 2;
  long long res = 0;
  for (int y = xs[1][0]; y < xs[1][1]; ++y) {
    for (int iter = 0; iter < 2; ++iter)
      for (int i = 0; i <= k; ++i)
        a[y][iter][i] = !iter ? (xs[0][1] - midx) : (midx - xs[0][0]);
    for (int x = midx, cnt = 0; x < xs[0][1] && cnt <= k; ++x) {
      if (getValue(type, x, y)) a[y][0][cnt++] = x - midx;
    }
    for (int x = midx - 1, cnt = 0; x >= xs[0][0] && cnt <= k; --x) {
      if (getValue(type, x, y)) a[y][1][cnt++] = midx - x - 1;
    }
  }
  for (int l = xs[1][0]; l < xs[1][1]; ++l) {
    int cur[2][k + 1];
    for (int iter = 0; iter < 2; ++iter)
      for (int i = 0; i <= k; ++i)
        cur[iter][i] = !iter ? (xs[0][1] - midx) : (midx - xs[0][0]);
    int tmp[k + 1];
    for (int r = l; r < xs[1][1]; ++r) {
      for (int iter = 0; iter < 2; ++iter) {
        int i, j;
        for (i = 0, j = 0; i + j <= k; ++i) {
          while (i + j <= k && cur[iter][i] > a[r][iter][j])
            tmp[i + j] = a[r][iter][j], ++j;
          if (i + j <= k) tmp[i + j] = cur[iter][i];
        }
        while (i + j <= k) tmp[i + j] = a[r][iter][j], ++j;
        memcpy(cur[iter], tmp, sizeof(tmp));
      }
      for (int i = 0; i <= k; ++i) {
        int left = cur[0][i] - (!i ? 0 : cur[0][i - 1]);
        int right = cur[1][k - i] - (i == k ? 0 : cur[1][k - i - 1]);
        res += left * right;
      }
    }
  }
  if (!type) {
    res += solve(y1, y2, x1, midx);
    res += solve(y1, y2, midx, x2);
  } else {
    res += solve(y1, midx, x1, x2);
    res += solve(midx, y2, x1, x2);
  }
  return res;
}
char s[maxn + 1];
bool solve() {
  int h, w;
  if (scanf("%d%d%d", &h, &w, &k) < 3) return 0;
  for (int i = 0; i < h; ++i) {
    scanf("%s", s);
    for (int j = 0; j < w; ++j) table[i][j] = s[j] - '0';
  }
  long long ans = solve(0, h, 0, w);
  printf(
      "%lld"
      "\n",
      ans);
  return 1;
}
int main() {
  srand(rdtsc());
  while (1) {
    if (!solve()) break;
  }
  return 0;
}
