#include <bits/stdc++.h>
using namespace std;
void getre() {
  int x = 0;
  printf("%d\n", 1 / x);
}
void gettle() {
  int res = 1;
  while (1) res <<= 1;
  printf("%d\n", res);
}
template <typename T, typename S>
inline bool upmin(T &a, const S &b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool upmax(T &a, const S &b) {
  return a < b ? a = b, 1 : 0;
}
template <typename N, typename PN>
inline N flo(N a, PN b) {
  return a >= 0 ? a / b : -((-a - 1) / b) - 1;
}
template <typename N, typename PN>
inline N cei(N a, PN b) {
  return a > 0 ? (a - 1) / b + 1 : -(-a / b);
}
template <typename N>
N gcd(N a, N b) {
  return b ? gcd(b, a % b) : a;
}
template <typename N>
inline int sgn(N a) {
  return a > 0 ? 1 : (a < 0 ? -1 : 0);
}
inline void gn(long long &x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long &x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gn(long double &x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gs(char *s) { scanf("%s", s); }
inline void gc(char &c) {
  while ((c = getchar()) > 126 || c < 33)
    ;
}
inline void pc(char c) { putchar(c); }
inline long long sqr(long long a) { return a * a; }
inline double sqrf(double a) { return a * a; }
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846264338327950288L;
const double eps = 1e-6;
int k;
int a[3333][3333];
char str[3333];
long long glo_ans = 0;
int b[3333][3333];
int poslef[3333][10], posrig[3333][10];
int buf1[20], buf2[20], buf3[20], buf4[20];
int *curlef = buf1, *currig = buf2, *tmplef = buf3, *tmprig = buf4;
int cltop, crtop;
void add(int id) {
  int top1 = 1, top2 = 1;
  int tmpcltop = 0, tmpcrtop = 0;
  while (top1 <= cltop || poslef[id][top2] != -1) {
    if (top1 > cltop || poslef[id][top2] > curlef[top1])
      tmplef[++tmpcltop] = poslef[id][top2++];
    else
      tmplef[++tmpcltop] = curlef[top1++];
    if (tmpcltop >= k + 1) break;
  }
  top1 = 1, top2 = 1;
  while (top1 <= crtop || posrig[id][top2] != -1) {
    if (top1 > crtop ||
        posrig[id][top2] != -1 && posrig[id][top2] < currig[top1])
      tmprig[++tmpcrtop] = posrig[id][top2++];
    else
      tmprig[++tmpcrtop] = currig[top1++];
    if (tmpcrtop >= k + 1) break;
  }
  cltop = tmpcltop;
  crtop = tmpcrtop;
  swap(tmprig, currig);
  swap(tmplef, curlef);
}
void ask(int m) {
  int mid = 1 + m >> 1;
  curlef[0] = mid;
  currig[0] = mid;
  for (int i = (0), _ed = (k + 1); i < _ed; i++) {
    int j = k - i;
    if (i >= cltop) break;
    if (j >= crtop) continue;
    glo_ans += (curlef[i] - curlef[i + 1]) * (currig[j + 1] - currig[j]);
  }
}
void work(int xl, int xr, int yl, int yr) {
  int n = xr - xl + 1, m = yr - yl + 1;
  if (n < 1 || m < 1) return;
  int turn = 0;
  if (n > m) {
    turn = 1;
    for (int i = (1), _ed = (n + 1); i < _ed; i++)
      for (int j = (1), _ed = (m + 1); j < _ed; j++)
        b[j][i] = a[xl + i - 1][yl + j - 1];
    swap(n, m);
  } else {
    for (int i = (1), _ed = (n + 1); i < _ed; i++)
      for (int j = (1), _ed = (m + 1); j < _ed; j++)
        b[i][j] = a[xl + i - 1][yl + j - 1];
  }
  int mid = 1 + m >> 1;
  for (int i = (1), _ed = (n + 1); i < _ed; i++)
    for (int j = (0), _ed = (k + 3); j < _ed; j++)
      poslef[i][j] = posrig[i][j] = -1;
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    int top;
    top = 0;
    for (int j = (mid + 1) - 1, _ed = (1); j >= _ed; j--)
      if (b[i][j]) {
        poslef[i][++top] = j;
        if (top == k + 1) break;
      }
    top = 0;
    for (int j = (mid + 1), _ed = (m + 1); j < _ed; j++)
      if (b[i][j]) {
        posrig[i][++top] = j;
        if (top == k + 1) break;
      }
  }
  for (int st = (1), _ed = (n + 1); st < _ed; st++) {
    curlef[cltop = 1] = 0;
    currig[crtop = 1] = m + 1;
    for (int rig = (st), _ed = (n + 1); rig < _ed; rig++) {
      add(rig);
      ask(m);
    }
  }
  if (turn)
    work(xl, (xl + xr >> 1) - 1, yl, yr), work((xl + xr >> 1) + 1, xr, yl, yr);
  else
    work(xl, xr, yl, (yl + yr >> 1) - 1),
        work(xl, xr, ((yl + yr >> 1) + 1), yr);
}
int n, m;
int main() {
  gn(n);
  gn(m);
  gn(k);
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    gs(str + 1);
    for (int j = (1), _ed = (m + 1); j < _ed; j++) a[i][j] = str[j] - '0';
  }
  work(1, n, 1, m);
  cout << glo_ans << endl;
  return 0;
}
