#include <bits/stdc++.h>
using namespace std;
char ch;
long long ans;
int i, j, k, n, m, lim, a[3001][3001], sr[3001][3001], sc[3001][3001], q1[11],
    q2[11], b1[3001][11], b2[3001][11], p1, p2, w, ss[3001][3001];
int getsum(int x1, int y1, int x2, int y2) {
  return ss[x2][y2] - ss[x1 - 1][y2] - ss[x2][y1 - 1] + ss[x1 - 1][y1 - 1];
}
void calc() {
  int i, j, k, t;
  if (!q1[0] && !q2[0]) {
    if (!lim) ans += (long long)(w - p1 + 1) * (long long)(p2 - w);
    return;
  }
  for (i = q1[0]; i; i = j - 1) {
    for (j = i; j > 1 && q1[j - 1] == q1[i]; j--)
      ;
    if (i == lim) {
      k = q1[i] - p1 + 1;
      t = (q2[0]) ? q2[1] - w - 1 : p2 - w;
      ans += (long long)k * (long long)t;
      continue;
    }
    if (q2[0] < lim - i || q2[0] > lim - i && q2[lim - i] == q2[lim - i + 1])
      continue;
    if (i == q1[0])
      k = q1[i] - p1 + 1;
    else
      k = q1[i] - q1[i + 1];
    if (lim - i == q2[0])
      t = p2 - q2[lim - i] + 1;
    else
      t = q2[lim - i + 1] - q2[lim - i];
    ans += (long long)k * (long long)t;
  }
  if (q2[0] == lim) {
    k = (q1[0]) ? w - q1[1] : w - p1 + 1;
    t = p2 - q2[lim] + 1;
    ans += (long long)k * (long long)t;
  }
}
void solve(int x1, int y1, int x2, int y2) {
  int i, j, k, t, bw;
  if (x1 > x2 || y1 > y2) return;
  if (x1 == x2 && y1 == y2) {
    if (a[x1][y1] == lim) ans++;
    return;
  }
  if (x2 - x1 >= y2 - y1) {
    bw = w = (x1 + x2) >> 1;
    for (i = y1; i <= y2; i++) {
      for (b1[i][0] = 0, j = w; j >= x1 && b1[i][0] < lim; j--)
        if (a[j][i]) b1[i][++b1[i][0]] = j;
      for (b2[i][0] = 0, j = w + 1; j <= x2 && b2[i][0] < lim; j++)
        if (a[j][i]) b2[i][++b2[i][0]] = j;
    }
    for (i = y1; i <= y2; i++) {
      q1[0] = q2[0] = 0;
      p1 = x1;
      p2 = x2;
      for (j = i; j <= y2; j++) {
        for (; p1 <= w && getsum(p1, i, w, j) > lim; p1++)
          ;
        for (; p2 >= w + 1 && getsum(w + 1, i, p2, j) > lim; p2--)
          ;
        for (; q1[0] && q1[q1[0]] < p1; q1[0]--)
          ;
        for (; q2[0] && q2[q2[0]] > p2; q2[0]--)
          ;
        for (k = 1; k <= b1[j][0]; k++) {
          if (b1[j][k] < p1) continue;
          q1[++q1[0]] = b1[j][k];
          for (t = q1[0]; t > 1 && q1[t] > q1[t - 1]; t--)
            swap(q1[t], q1[t - 1]);
        }
        for (k = 1; k <= b2[j][0]; k++) {
          if (b2[j][k] > p2) continue;
          q2[++q2[0]] = b2[j][k];
          for (t = q2[0]; t > 1 && q2[t] < q2[t - 1]; t--)
            swap(q2[t], q2[t - 1]);
        }
        calc();
      }
    }
    solve(x1, y1, bw, y2);
    solve(bw + 1, y1, x2, y2);
  } else {
    bw = w = (y1 + y2) >> 1;
    for (i = x1; i <= x2; i++) {
      for (b1[i][0] = 0, j = w; j >= y1 && b1[i][0] < lim; j--)
        if (a[i][j]) b1[i][++b1[i][0]] = j;
      for (b2[i][0] = 0, j = w + 1; j <= y2 && b2[i][0] < lim; j++)
        if (a[i][j]) b2[i][++b2[i][0]] = j;
    }
    for (i = x1; i <= x2; i++) {
      q1[0] = q2[0] = 0;
      p1 = y1;
      p2 = y2;
      for (j = i; j <= x2; j++) {
        for (; p1 <= w && getsum(i, p1, j, w) > lim; p1++)
          ;
        for (; p2 >= w + 1 && getsum(i, w + 1, j, p2) > lim; p2--)
          ;
        for (; q1[0] && q1[q1[0]] < p1; q1[0]--)
          ;
        for (; q2[0] && q2[q2[0]] > p2; q2[0]--)
          ;
        for (k = 1; k <= b1[j][0]; k++) {
          if (b1[j][k] < p1) continue;
          q1[++q1[0]] = b1[j][k];
          for (t = q1[0]; t > 1 && q1[t] > q1[t - 1]; t--)
            swap(q1[t], q1[t - 1]);
        }
        for (k = 1; k <= b2[j][0]; k++) {
          if (b2[j][k] > p2) continue;
          q2[++q2[0]] = b2[j][k];
          for (t = q2[0]; t > 1 && q2[t] < q2[t - 1]; t--)
            swap(q2[t], q2[t - 1]);
        }
        calc();
      }
    }
    solve(x1, y1, x2, bw);
    solve(x1, bw + 1, x2, y2);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &lim);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      for (ch = getchar(); ch != '0' && ch != '1'; ch = getchar())
        ;
      a[i][j] = ch - '0';
    }
  memset(sr, 0, sizeof(sr));
  memset(sc, 0, sizeof(sc));
  memset(ss, 0, sizeof(ss));
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      sr[i][j] = sr[i][j - 1] + a[i][j], sc[i][j] = sr[i - 1][j] + a[i][j],
      ss[i][j] = ss[i - 1][j] + ss[i][j - 1] - ss[i - 1][j - 1] + a[i][j];
  ans = 0;
  solve(1, 1, n, m);
  cout << ans << endl;
  return 0;
}
