#include <fstream>
#include <algorithm>

using namespace std;
ifstream fi("b_line.inp");
ofstream fo("b_line.out");

int main()
{
    ios::sync_with_stdio(false);
    int n,m,k,mx = -2e9,a[100000] = {0},tg;
    fi >> n >> m >> k;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            fi >> tg;
            mx = max(mx,tg);
            a[tg]++;
        }
    }
    sort(a,a+mx+1);
    int t = 0;
    for (int i = mx; i >= mx - k + 1; i--)
        t += a[i];
    fo << t;
    return 0;
}
