#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int fl[2600][2600];
template <int N>
struct myvector {
  pair<int, int> stor[N];
  int sz;
  inline pair<int, int>& operator[](int i) { return stor[i]; }
  inline const pair<int, int>& operator[](int i) const { return stor[i]; }
  inline void sort() { std::sort(stor, stor + sz); }
  inline myvector() { sz = 0; }
  inline void pop_back() { sz--; }
  inline int size() const { return sz; }
  inline void push_back(const pair<int, int>& p) { stor[sz++] = p; }
  template <int m>
  inline void insert(const myvector<m>& a) {
    for (int i = 0; i < a.sz; i++) push_back(a.stor[i]);
  }
  inline void clear() { sz = 0; }
};
inline int imul(int a, int b) { return a == 0 ? 0 : b; }
struct View {
  int int_mtr[3][3];
  int xlim;
  int ylim;
  inline int get(int x, int y) {
    int nx, ny;
    nx = imul(int_mtr[0][0], x) + imul(int_mtr[0][1], y) + int_mtr[0][2];
    ny = imul(int_mtr[1][0], x) + imul(int_mtr[1][1], y) + int_mtr[1][2];
    return fl[nx][ny];
  }
  View() { memset(int_mtr, 0, sizeof int_mtr); }
};
View simpleView(int x0, int x1, int y0, int y1) {
  View nw;
  nw.int_mtr[0][0] = 1;
  nw.int_mtr[0][2] = x0;
  nw.int_mtr[1][1] = 1;
  nw.int_mtr[1][2] = y0;
  nw.int_mtr[2][2] = 1;
  nw.xlim = x1 - x0;
  nw.ylim = y1 - y0;
  return nw;
}
View swapxy(const View& v) {
  View nw;
  memcpy(nw.int_mtr, v.int_mtr, sizeof(v.int_mtr));
  for (int i = 0; i < 3; i++) swap(nw.int_mtr[i][0], nw.int_mtr[i][1]);
  nw.xlim = v.ylim;
  nw.ylim = v.xlim;
  return nw;
}
View comp(const View& u, const View& v) {
  View nw;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 3; k++) {
        nw.int_mtr[i][j] += v.int_mtr[i][k] * u.int_mtr[k][j];
      }
    }
  }
  nw.xlim = u.xlim;
  nw.ylim = u.ylim;
  return nw;
}
myvector<30> evl[2600], evr[2600];
inline void merge(const myvector<30>& v1, myvector<30>& v2, int k) {
  memcpy(v2.stor + 15, v2.stor, (15 - 1) * sizeof(pair<int, int>));
  int csum = 0, c1 = 0, c2 = 0;
  int ll = 0;
  while (csum <= k) {
    if (c2 == v2.size() || (c1 < v1.size() && v1[c1] < v2[c2])) {
      if (ll != 0 && v2[15 + ll - 1].first == v1[c1].first)
        v2[15 + ll - 1].second += v1[c1].second;
      else
        v2[15 + (ll++)] = v1[c1];
      csum += v1[c1].second;
      c1++;
    } else {
      if (ll != 0 && v2[15 + ll - 1].first == v2[c2].first)
        v2[15 + ll - 1].second += v2[c2].second;
      else
        v2[15 + (ll++)] = v2[c2];
      csum += v2[c2].second;
      c2++;
    }
  }
  memcpy(v2.stor, v2.stor + 15, ll * sizeof(pair<int, int>));
  v2.sz = ll;
}
myvector<30> vl, vr;
long long rect(View v, int k) {
  if (v.xlim < v.ylim) return rect(swapxy(v), k);
  if (v.xlim == 1) {
    return v.get(0, 0) == k;
  }
  int spx = v.xlim / 2;
  for (int i = 0; i < v.ylim; i++) {
    evl[i].clear();
    evr[i].clear();
  }
  for (int i = 0; i < v.ylim; i++) {
    for (int j = spx - 1; j >= 0; j--)
      if (v.get(j, i) == 1 && evl[i].size() <= k)
        evl[i].push_back(make_pair(spx - j - 1, 1));
    for (int j = spx; j < v.xlim; j++)
      if (v.get(j, i) == 1 && evr[i].size() <= k)
        evr[i].push_back(make_pair(j - spx, 1));
    if (evl[i].size() <= k) evl[i].push_back(make_pair(spx, 4000));
    if (evr[i].size() <= k) evr[i].push_back(make_pair(v.xlim - spx, 4000));
  }
  long long ans = 0;
  for (int l = 0; l < v.ylim; l++) {
    vl.clear();
    vr.clear();
    for (int r = l; r < v.ylim; r++) {
      merge(evl[r], vl, k);
      merge(evr[r], vr, k);
      int lsum = 0, lc = 0, rsum = 0, rc = 0;
      while (lsum < k) lsum += vl[lc++].second;
      while (lc >= 0) {
        while (rsum + lsum < k) rsum += vr[rc++].second;
        if (lsum + rsum == k) {
          ans += (lc != 0 ? vl[lc].first - vl[lc - 1].first : vl[lc].first) *
                 (rc != 0 ? vr[rc].first - vr[rc - 1].first : vr[rc].first);
        }
        lsum -= vl[--lc].second;
      }
    }
  }
  return ans + rect(comp(simpleView(0, spx, 0, v.ylim), v), k) +
         rect(comp(simpleView(spx, v.xlim, 0, v.ylim), v), k);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c;
      cin >> c;
      fl[i][j] = c == '1';
    }
  }
  cout << rect(simpleView(0, n, 0, m), k);
}
