#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n, m;
	while (cin >> n >> m, n | m) {
		if (n <= 36) {
			int n1 = n / 2, n2 = n - n1;
			vector<vector<bool>> b(n, vector<bool>(m));
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < m; j++) {
					char c;
					cin >> c;
					b[i][j] = c == '1';
				}
			}
			map<vector<bool>, int> mp;
			for (int i = 0; i < (1 << n1); i++) {
				vector<bool> bs(m);
				for (int j = 0; j < n1; j++) if (i & (1 << j)) {
					for (int k = 0; k < m; k++) {
						bs[k] = b[j][k] ^ bs[k];
					}
				}
				auto& val = mp[bs];
				val = max(val, __builtin_popcount(i));
			}
			int res = 0;
			for (int i = 0; i < (1 << n2); i++) {
				vector<bool> bs(m);
				for (int j = 0; j < n2; j++) if (i & (1 << j)) {
					for (int k = 0; k < m; k++) {
						bs[k] = b[n1 + j][k] ^ bs[k];
					}
				}
				if (mp.count(bs)) res = max(res, mp[bs] + __builtin_popcount(i));
			}
			cout << res << endl;
			continue;
		}
		vector<int> b(n);
		vector<int> dp(1 << m, -1e9);
		dp[0] = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				char c;
				cin >> c;
				b[i] |= (c == '1') << j;
			}
			auto tmp = dp;
			for (int j = 0; j < (1 << m); j++) {
				dp[j ^ b[i]] = max(dp[j ^ b[i]], tmp[j] + 1);
			}
		}
		cout << dp[0] << endl;
	}
	return 0;
}

