#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const long long LINF = (long long)1e18;
const long double PI = acos((long double)-1);
const long double EPS = 1e-9;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long fpow(long long n, long long k, int p = MOD) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
template <class T>
inline int chkmin(T& a, const T& val) {
  return val < a ? a = val, 1 : 0;
}
template <class T>
inline int chkmax(T& a, const T& val) {
  return a < val ? a = val, 1 : 0;
}
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline void addmod(int& a, int val, int p = MOD) {
  if ((a = (a + val)) >= p) a -= p;
}
inline void submod(int& a, int val, int p = MOD) {
  if ((a = (a - val)) < 0) a += p;
}
inline int mult(int a, int b, int p = MOD) { return (long long)a * b % p; }
inline int inv(int a, int p = MOD) { return fpow(a, p - 2, p); }
inline int sign(long double x) { return x < -EPS ? -1 : x > +EPS; }
inline int sign(long double x, long double y) { return sign(x - y); }
const int maxn = 2500 + 5;
int n, m, k;
int a[maxn][maxn];
int b[maxn][maxn];
long long divide(int n, int m, int px, int py, int t) {
  if (!n || !m) return 0;
  if (n == 1 && m == 1) {
    return (!t && a[px][py] == k) || (t && b[px][py] == k);
  }
  long long res = 0;
  int mid = n - 1 >> 1;
  static int up[maxn][maxn];
  static int dn[maxn][maxn];
  static int nup[maxn];
  static int ndn[maxn];
  fill_n(nup, m, 0), fill_n(ndn, m, 0);
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++)
      if ((!t && a[px + i][py + j]) || (t && b[px + i][py + j])) {
        if (i <= mid) {
          up[j][nup[j]++] = i;
        } else {
          dn[j][ndn[j]++] = i;
        }
      }
  for (int i = (0); i < (m); i++) reverse(up[i], up[i] + nup[i]);
  for (int i = (0); i < (m); i++) {
    static int vup[maxn];
    static int vdn[maxn];
    int nvup = 0;
    int nvdn = 0;
    for (int j = (i); j < (m); j++) {
      for (int l = 0; l < nup[j] && l < k + 1; l++) {
        int x = up[j][l];
        vup[nvup++] = x;
        for (int p = (nvup - 1) - 1; p >= (0); p--) {
          if (vup[p] < vup[p + 1]) {
            swap(vup[p], vup[p + 1]);
          }
        }
        chkmin(nvup, k + 1);
      }
      for (int l = 0; l < ndn[j] && l < k + 1; l++) {
        int x = dn[j][l];
        vdn[nvdn++] = x;
        for (int p = (nvdn - 1) - 1; p >= (0); p--) {
          if (vdn[p] > vdn[p + 1]) {
            swap(vdn[p], vdn[p + 1]);
          }
        }
        chkmin(nvdn, k + 1);
      }
      for (int l = (0); l < (min(nvup, k - 1)); l++) {
        int x = l == nvup - 1 ? vup[l] + 1 : vup[l] - vup[l + 1];
        int p = k - l - 2;
        if (p >= nvdn) continue;
        int y = p == nvdn - 1 ? n - vdn[p] : vdn[p + 1] - vdn[p];
        res += x * y;
      }
      if (k) {
        if (nvup >= k) {
          int x = k - 1 == nvup - 1 ? vup[k - 1] + 1 : vup[k - 1] - vup[k];
          int y = nvdn ? vdn[0] - mid - 1 : n - mid - 1;
          res += x * y;
        }
        if (nvdn >= k) {
          int x = k - 1 == nvdn - 1 ? n - vdn[k - 1] : vdn[k] - vdn[k - 1];
          int y = nvup ? mid - vup[0] : mid + 1;
          res += x * y;
        }
      } else {
        int x = nvup ? mid - vup[0] : mid + 1;
        int y = nvdn ? vdn[0] - mid - 1 : n - mid - 1;
        res += x * y;
      }
    }
  }
  int n1 = mid + 1;
  int n2 = n - n1;
  res += divide(m, n1, py, px, !t);
  res += divide(m, n2, py, px + n1, !t);
  return res;
}
void solve() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = (0); i < (n); i++) {
    static char s[maxn];
    scanf("%s", s);
    for (int j = (0); j < (m); j++) a[i][j] = b[j][i] = s[j] == '1';
  }
  printf("%I64d\n", divide(n, m, 0, 0, 0));
}
int main() {
  int JUDGE_ONLINE = 1;
  if (fopen("in.txt", "r")) {
    JUDGE_ONLINE = 0;
    assert(freopen("in.txt", "r", stdin));
  } else {
  }
  solve();
  if (!JUDGE_ONLINE) {
  }
  return 0;
}
