Sereja has an *n* × *m* rectangular table *a*, each cell of the table contains a zero or a number one. Sereja wants his table to meet the following requirement: each connected component of the same values forms a rectangle with sides parallel to the sides of the table. Rectangles should be filled with cells, that is, if a component form a rectangle of size *h* × *w*, then the component must contain exactly *hw* cells.

A connected component of the same values is a set of cells of the table that meet the following conditions:
 -  every two cells of the set have the same value; -  the cells of the set form a connected region on the table (two cells are connected if they are adjacent in some row or some column of the table); -  it is impossible to add any cell to the set unless we violate the two previous conditions. 
Can Sereja change the values of at most *k* cells of the table so that the table met the described requirement? What minimum number of table cells should he change in this case?
The first line contains integers *n*, *m* and *k* (1 ≤ *n*, *m* ≤ 100; 1 ≤ *k* ≤ 10). Next *n* lines describe the table *a*: the *i*-th of them contains *m* integers *a*<sub class="lower-index">*i*1</sub>, *a*<sub class="lower-index">*i*2</sub>, ..., *a*<sub class="lower-index">*im*</sub> (0 ≤ *a*<sub class="lower-index">*i*, *j*</sub> ≤ 1) — the values in the cells of the *i*-th row.
/* Author haleyk10198 */
/* �@��:  haleyk10198 */
/* CF handle: haleyk100198*/
#include <bits/stdc++.h>

#define MOD 1000000007
#define LINF (1LL<<60)
#define INF 2147483647
#define PI 3.1415926535897932384626433
#define ll long long
#define pii pair<int,int>
#define mp(x,y) make_pair((x),(y))
#define pb(x) push_back((x))

using namespace std;

string itos(int x){
	stringstream ss;
	ss << x;
	return ss.str();
}

int b[110][110], n, m, k, res = MOD;

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin >> n >> m >> k;
	for(int i = 0; i < n; i++)
		for(int j = 0; j < m; j++)
			cin >> b[i][j];
	
	if(n <= k){
		for(int i = 0; i < (1<<n); i++){
			int now = 0;
			for(int j = 0; j < m; j++){
				int sum = 0;
				for(int k = 0; k < n; k++)
					sum += (b[k][j] == (i>>k)%2);
				now += min(sum, n-sum);
			}
			res = min(res, now);
		}
	}
	else{
		for(int i = 0; i < n; i++){
			int now = 0;
			for(int j = 0; j < n; j++){
				if(i == j) continue;
				int sum = 0;
				for(int k = 0; k < m; k++)
					sum += (b[j][k] == b[i][k]);
				now += min(sum, m-sum);
			}
			res = min(res, now);
		}
	}
	cout << (res > k? -1: res) << endl;
	return 0;
}

