#include <bits/stdc++.h>
using namespace std;
template <class Num>
inline void read(Num &x) {
  char c;
  int flag = 1;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= flag;
}
template <class Num>
inline void write(Num x) {
  if (x < 0) putchar('-'), x = -x;
  static char s[20];
  int sl = 0;
  while (x) s[sl++] = x % 10 + '0', x /= 10;
  if (!sl) {
    putchar('0');
    return;
  }
  while (sl) putchar(s[--sl]);
}
template <typename T>
bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
bool chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const int MAXN = 2500 + 100;
const int MAXK = 6 + 3;
int N, M, K;
int s[MAXN][MAXN], up[MAXK], down[MAXK];
long long ans;
inline int S(int x1, int y1, int x2, int y2) {
  return s[x2][y2] - s[x1][y2] - s[x2][y1] + s[x1][y1];
}
void work(int x1, int y1, int x2, int y2) {
  if (x1 == x2 || y1 == y2) return;
  if (x1 + 1 == x2 && y1 + 1 == y2) {
    ans += S(x1, y1, x2, y2) == K;
    return;
  }
  if (x2 - x1 > y2 - y1) {
    int m = (x1 + x2) >> 1;
    work(x1, y1, m, y2);
    work(m, y1, x2, y2);
    for (int i = y1; i < y2; ++i) {
      up[0] = down[0] = m;
      for (int k = 1; k <= K + 1; ++k) up[k] = x1, down[k] = x2;
      for (int j = i + 1; j <= y2; ++j) {
        for (int k = 1; k <= K + 1; ++k) {
          while (S(up[k], i, m, j) >= k) up[k]++;
          while (S(m, i, down[k], j) >= k) down[k]--;
        }
        for (int k = 0; k <= K; ++k)
          ans += (up[k] - up[k + 1]) * (down[K - k + 1] - down[K - k]);
      }
    }
  } else {
    int m = (y1 + y2) >> 1;
    work(x1, y1, x2, m);
    work(x1, m, x2, y2);
    for (int i = x1; i < x2; ++i) {
      up[0] = down[0] = m;
      for (int k = 1; k <= K + 1; ++k) up[k] = y1, down[k] = y2;
      for (int j = i + 1; j <= x2; ++j) {
        for (int k = 1; k <= K + 1; ++k) {
          while (S(i, up[k], j, m) >= k) ++up[k];
          while (S(i, m, j, down[k]) >= k) --down[k];
        }
        for (int k = 0; k <= K; ++k)
          ans += (up[k] - up[k + 1]) * (down[K - k + 1] - down[K - k]);
      }
    }
  }
}
void init() {
  scanf("%d%d%d", &N, &M, &K);
  for (int i = 1; i <= N; ++i) {
    getchar();
    for (int j = 1; j <= M; ++j) {
      char c = getchar();
      s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + c - '0';
    }
  }
}
void solve() {
  ans = 0;
  work(0, 0, N, M);
  printf("%I64d\n", ans);
}
int main() {
  init();
  solve();
  return 0;
}
