#include <bits/stdc++.h>
inline int read() {
  int r = 0, f = 0;
  char c;
  while (!isdigit(c = getchar())) f |= (c == '-');
  while (isdigit(c)) r = (r << 1) + (r << 3) + (c ^ 48), c = getchar();
  return f ? -r : r;
}
int n, m, k, sum[3333][3333];
char s[3333][3333];
int pos[2][11];
long long ans;
inline int cnt(int x1, int y1, int x2, int y2) {
  return sum[x2][y2] - sum[x1 - 1][y2] - sum[x2][y1 - 1] + sum[x1 - 1][y1 - 1];
}
void solve(int x1, int y1, int x2, int y2, bool f) {
  if (x1 > x2 || y1 > y2) return;
  if (x1 == x2 && y1 == y2) {
    ans += ((s[x1][y1] ^ 48) == k);
    return;
  }
  if (!f) {
    int mid = (x1 + x2) >> 1;
    solve(x1, y1, mid, y2, 1);
    solve(mid + 1, y1, x2, y2, 1);
    for (int i = y1; i <= y2; i++) {
      pos[0][0] = mid + 1, pos[1][0] = mid;
      for (int j = 1; j <= k + 1; j++) pos[0][j] = x1, pos[1][j] = x2;
      for (int j = i; j <= y2; j++) {
        for (int x = 1; x <= k + 1; x++)
          while (cnt(pos[0][x], i, mid, j) >= x) pos[0][x]++;
        for (int x = 1; x <= k + 1; x++)
          while (cnt(mid + 1, i, pos[1][x], j) >= x) pos[1][x]--;
        for (int x = 0; x <= k; x++)
          ans += 1ll * (pos[0][x] - pos[0][x + 1]) *
                 (pos[1][k - x + 1] - pos[1][k - x]);
      }
    }
    return;
  } else {
    int mid = (y1 + y2) >> 1;
    solve(x1, y1, x2, mid, 0);
    solve(x1, mid + 1, x2, y2, 0);
    for (int i = x1; i <= x2; i++) {
      pos[0][0] = mid + 1, pos[1][0] = mid;
      for (int j = 1; j <= k + 1; j++) pos[0][j] = y1, pos[1][j] = y2;
      for (int j = i; j <= x2; j++) {
        for (int x = 1; x <= k + 1; x++)
          while (cnt(i, pos[0][x], j, mid) >= x) pos[0][x]++;
        for (int x = 1; x <= k + 1; x++)
          while (cnt(i, mid + 1, j, pos[1][x]) >= x) pos[1][x]--;
        for (int x = 0; x <= k; x++)
          ans += 1ll * (pos[0][x] - pos[0][x + 1]) *
                 (pos[1][k - x + 1] - pos[1][k - x]);
      }
    }
    return;
  }
}
int main() {
  n = read(), m = read(), k = read();
  for (int i = 1; i <= n; i++) scanf("%s\n", s[i] + 1);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      sum[i][j] =
          (s[i][j] ^ 48) + sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1];
  solve(1, 1, n, m, 0);
  printf("%lld\n", ans);
  return 0;
}
