#include <bits/stdc++.h>
using namespace std;
int n, m, K, S[2510][2510], p1[10], p2[10];
long long ans;
char str[2510][2510];
inline int calc(int lx, int ly, int rx, int ry) {
  return S[rx][ry] - S[lx - 1][ry] - S[rx][ly - 1] + S[lx - 1][ly - 1];
}
void solve(int lx, int ly, int rx, int ry, bool dir) {
  if (lx > rx || ly > ry) return;
  if (lx == rx && ly == ry) {
    ans += (str[lx][ly] - '0') == K;
    return;
  }
  if (dir) {
    int mid = (ly + ry) / 2;
    for (int l = lx; l <= rx; l++) {
      for (int j = 0; j <= K; j++) p1[j] = ly, p2[j] = ry;
      for (int r = l; r <= rx; r++) {
        for (int i = 0; i <= K; i++) {
          while (p1[i] <= mid && calc(l, p1[i], r, mid) > i) p1[i]++;
          while (p2[i] > mid && calc(l, mid + 1, r, p2[i]) > i) p2[i]--;
        }
        for (int i = 0; i <= K; i++)
          ans += (i ? p1[i - 1] - p1[i] : mid - p1[i] + 1) *
                 ((K - i) ? p2[K - i] - p2[K - i - 1] : p2[K - i] - mid);
      }
    }
    solve(lx, ly, rx, mid, 0);
    solve(lx, mid + 1, rx, ry, 0);
  } else {
    int mid = (lx + rx) / 2;
    for (int l = ly; l <= ry; l++) {
      for (int j = 0; j <= K; j++) p1[j] = lx, p2[j] = rx;
      for (int r = l; r <= ry; r++) {
        for (int i = 0; i <= K; i++) {
          while (p1[i] <= mid && calc(p1[i], l, mid, r) > i) p1[i]++;
          while (p2[i] > mid && calc(mid + 1, l, p2[i], r) > i) p2[i]--;
        }
        for (int i = 0; i <= K; i++)
          ans += (i ? p1[i - 1] - p1[i] : mid - p1[i] + 1) *
                 ((K - i) ? p2[K - i] - p2[K - i - 1] : p2[K - i] - mid);
      }
    }
    solve(lx, ly, mid, ry, 1);
    solve(mid + 1, ly, rx, ry, 1);
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &K);
  for (int i = 1; i <= n; i++) {
    scanf("%s", str[i] + 1);
    for (int j = 1; j <= m; j++)
      S[i][j] = S[i - 1][j] + S[i][j - 1] - S[i - 1][j - 1] + (str[i][j] - '0');
  }
  solve(1, 1, n, m, 0);
  printf("%lld\n", ans);
  return 0;
}
