#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2505;
set<int> C[MAXN];
vector<int> p[MAXN];
char a[MAXN][MAXN];
int h[MAXN];
long long inc(set<int>::iterator it, set<int> &S, int k) {
  int row = *it;
  if (h[row] > k) return 0;
  int sumLeft = h[row];
  auto itl = it;
  --itl;
  while (itl != S.begin() && sumLeft + h[*itl] <= k) sumLeft += h[*(itl--)];
  auto itr = it, itr2 = it;
  auto prevl = itl;
  auto prevr = itr;
  auto prevr2 = itr2;
  ++itl, ++itr, ++itr2;
  long long ans = 0;
  int sum = sumLeft, sum2 = sumLeft + 1;
  while (1) {
    while (sum + h[*itr] <= k) prevr = itr, sum += h[*(itr++)];
    while (sum2 + h[*itr2] <= k) prevr2 = itr2, sum2 += h[*(itr2++)];
    if (sum == k) ans -= (*itl - *prevl) * (*itr - *prevr);
    if (sum2 == k) ans += (*itl - *prevl) * (*itr2 - *prevr2);
    sum -= h[*itl], sum2 -= h[*itl];
    if (itl == it) break;
    prevl = itl, itl++;
  }
  h[row]++;
  return ans;
}
int main(void) {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 0; i < (n); ++i) scanf("%s", a[i]);
  long long ans = 0;
  for (int l = m - 1; l >= 0; --l) {
    for (int i = 0; i < (n); ++i)
      if (a[i][l] == '1') {
        p[i].push_back(l);
        C[l].insert(i);
        if ((int)p[i].size() > k + 1) C[p[i][p[i].size() - k - 2]].erase(i);
      }
    static set<int> S;
    S.clear();
    S.insert(-1);
    S.insert(n);
    for (int i = 0; i < (n); ++i) h[i] = 0;
    h[n] = k + 1;
    auto it = S.end();
    long long sum = 0;
    if (k == 0) sum = n * (n + 1) / 2;
    for (int r = l; r < m; ++r) {
      for (int row : C[r]) {
        tie(it, ignore) = S.insert(row);
        sum += inc(it, S, k);
      }
      ans += sum;
    }
  }
  cout << ans << endl;
  return 0;
}
