#include <bits/stdc++.h>
const int oo = 0x3f3f3f3f;
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, true : false;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return b < a ? a = b, true : false;
}
std::string procStatus() {
  std::ifstream t("/proc/self/status");
  return std::string(std::istreambuf_iterator<char>(t),
                     std::istreambuf_iterator<char>());
}
template <typename T>
T read(T &first) {
  int f = 1;
  char ch = getchar_unlocked();
  for (; !isdigit(ch); ch = getchar_unlocked())
    if (ch == '-') f = -1;
  for (first = 0; isdigit(ch); ch = getchar_unlocked())
    first = 10 * first + ch - '0';
  return first *= f;
}
template <typename T>
void write(T first) {
  if (first == 0) {
    putchar_unlocked('0');
    return;
  }
  if (first < 0) {
    putchar_unlocked('-');
    first = -first;
  }
  static char s[20];
  int top = 0;
  for (; first; first /= 10) s[++top] = first % 10 + '0';
  while (top) putchar_unlocked(s[top--]);
}
const int MAXN = 2.5e3 + 5, SIZE = MAXN * MAXN;
int N, M, K;
int A[MAXN][MAXN];
int sum[MAXN][MAXN];
long long ans;
inline int query(int x0, int y0, int x1, int y1) {
  return sum[x1][y1] - sum[x1][y0 - 1] - sum[x0 - 1][y1] + sum[x0 - 1][y0 - 1];
}
void calc(int L, int R, int U, int D, bool f) {
  if (L > R) return;
  if (f) {
    int mid = (L + R) >> 1;
    calc(L, mid - 1, U, D, !f);
    calc(mid + 1, R, U, D, !f);
    for (int left = 0; left <= K; ++left) {
      for (int u = U; u <= D; ++u) {
        int p1 = L, p2 = L, q1 = R, q2 = R;
        for (int d = u; d <= D; ++d) {
          while (p1 <= mid && query(u, p1, d, mid) > left) ++p1;
          while (p2 <= mid && query(u, p2, d, mid) >= left) ++p2;
          while (q1 >= mid + 1 && query(u, mid + 1, d, q1) > K - left) --q1;
          while (q2 >= mid + 1 && query(u, mid + 1, d, q2) >= K - left) --q2;
          if (query(u, p1, d, mid) == left &&
              query(u, mid + 1, d, q1) == K - left)
            ans += (long long)(p2 - p1) * (q1 - q2 + (K - left == 0));
        }
      }
    }
  } else {
    int mid = (U + D) >> 1;
    calc(L, R, U, mid - 1, !f);
    calc(L, R, mid + 1, D, !f);
    for (int left = 0; left <= K; ++left) {
      for (int l = L; l <= R; ++l) {
        int p1 = U, p2 = U, q1 = D, q2 = D;
        for (int r = l; r <= R; ++r) {
          while (p1 <= mid && query(p1, l, mid, r) > left) ++p1;
          while (p2 <= mid && query(p2, l, mid, r) >= left) ++p2;
          while (q1 >= mid + 1 && query(mid + 1, l, q1, r) > K - left) --q1;
          while (q2 >= mid + 1 && query(mid + 1, l, q2, r) >= K - left) --q2;
          if (query(p1, l, mid, r) == left &&
              query(mid + 1, l, q1, r) == K - left)
            ans += (long long)(p2 - p1) * (q1 - q2 + (K - left == 0));
        }
      }
    }
  }
}
void input() {
  read(N);
  read(M);
  read(K);
  for (int i = 1; i <= N; ++i) {
    static char s[MAXN];
    scanf("%s", s);
    for (int j = 1; j <= M; ++j) {
      A[i][j] = s[j - 1] == '1';
    }
  }
}
void solve() {
  for (int i = 1; i <= N; ++i) {
    for (int j = 1; j <= M; ++j) {
      sum[i][j] = sum[i][j - 1] + sum[i - 1][j] - sum[i - 1][j - 1] + A[i][j];
    }
  }
  calc(1, M, 1, N, 1);
  write(ans);
  putchar_unlocked('\n');
}
int main() {
  input();
  solve();
  return 0;
}
