#include<bits/stdc++.h>
using namespace std;
int m[1000][1000],tn[1000][1000],y[100000];
int main(){
int a,b,c,d;
cin>>a>>b>>c;
d=a*b;
for(int e=0;e<a;e++){
for(int f=0;f<b;f++){
cin>>m[e][f];
tn[e][f]=m[e][f];
}
}
for(int e=1;e<a-1;e++){
for(int f=1;f<b-1;f++){
tn[e][f]=max(m[e][f],min(min(m[e-1][f],m[e+1][f]),min(m[e][f-1],m[e][f+1])));
}
}
for(int e=0;e<a;e++){
for(int f=0;f<b;f++){
if(tn[e][f]<=c) y[tn[e][f]-1]++;
}
}
for(int e=0;e<c;e++){
d-=y[e];
cout<<d<<endl;
}
}
错了???