#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2500 + 10, MAXK = 7;
int k, sum[MAXN][MAXN], l[MAXK], r[MAXK];
long long Tohka;
vector<string> Rotate(vector<string>& a) {
  vector<string> Houki;
  for (int i = 0; i < (int)a[0].size(); ++i) {
    string str;
    for (int j = 0; j < (int)a.size(); ++j) str += a[j][i];
    Houki.push_back(str);
  }
  return Houki;
}
int Gets(int xl, int yl, int xr, int yr) {
  return sum[xr][yr] - sum[xl - 1][yr] - sum[xr][yl - 1] + sum[xl - 1][yl - 1];
}
void solve(vector<string> a) {
  if (a.size() == 0 || a[0].size() == 0) return;
  if (a.size() > a[0].size()) a = Rotate(a);
  int n = (int)a.size(), m = (int)a[0].size();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] +
                  (a[i - 1][j - 1] == '1');
  int mid = (m + 1) / 2;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) l[j] = 1, r[j] = m;
    for (int j = i; j <= n; ++j) {
      for (int p = 0; p <= k; ++p) {
        for (; l[p] <= mid && Gets(i, l[p], j, mid) > p; ++l[p])
          ;
        for (; r[p] > mid && Gets(i, mid + 1, j, r[p]) > p; --r[p])
          ;
      }
      for (int lp = 0, rp = k; lp <= k; ++lp, --rp) {
        int ls = (lp ? l[lp - 1] : (mid + 1)) - l[lp],
            rs = r[rp] - (rp ? r[rp - 1] : mid - 1);
        Tohka += (long long)ls * rs;
      }
    }
  }
  vector<string> lstr, rstr;
  for (int i = 0; i < n; ++i) {
    string ls, rs;
    for (int j = 0; j < m; ++j) {
      if (j + 1 < mid) ls += a[i][j];
      if (j + 1 > mid) rs += a[i][j];
    }
    lstr.push_back(ls), rstr.push_back(rs);
  }
  solve(lstr), solve(rstr);
}
int main() {
  int n, m;
  vector<string> a;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; ++i) {
    string str;
    cin >> str;
    a.push_back(str);
  }
  solve(a);
  cout << Tohka << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
