#include <bits/stdc++.h>

using namespace std;

#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

#define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << endl
#define LINE cout << "line : " << __LINE__ << endl
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl;
#define STOP assert(false);
#else
#define dump(x) ;
#define LINE 	;
#define dumpV(v);
#define STOP 	;
#endif

namespace std{
  template<class S,class T>
  ostream &operator <<(ostream& out,const pair<S,T>& a){
    out<<'('<<a.fi<<", "<<a.se<<')';
    return out;
  }
}


ll dp[(1 << 23)][2];

int bitNum(int n) {
	int ret = 0;
	while(n > 0) {
		ret += n & 1;
		n >>= 1;
	}
	return ret;
}

int main() {
	int n, m;
	while (cin >> n >> m) {
		if (n * m == 0) break;
		vector<string> s(n);
		rep(i, n) cin >> s[i];

		auto brute = [&] {
			typedef bitset<510> B;
			vector<B> bits(n);
			rep(i, n) rep(j, m) if(s[i][j] == '1') bits[i][j] = true;
			int ret = 0;
			rep(mask, (1 << n)) {
				B tmp;
				rep(i, n) if((1<<i)&mask) tmp ^= bits[i];
				if(tmp.none()) ret = max(ret, bitNum(mask));
			}
			return ret;
		};
		auto bitDP = [&] {
			vector<int> bits(510);
			rep(i, n) {
				rep(j, m) if (s[i][j] == '1') bits[i] |= (1 << j);
			}
			rep(i, (1 << 23)) rep(j, 2) dp[i][j] = -1;
			dp[0][0] = 0;
			rep(i, n) {
				int now = i & 1, nxt = (i + 1) & 1;
				rep(mask, (1 << m)) dp[mask][nxt] = max(dp[mask][now], dp[mask][nxt]);
				rep(mask, (1 << m)) if(dp[mask][now]!=-1){
					int nmask = mask ^ bits[i];
					dp[nmask][nxt] = max(dp[nmask][nxt], dp[mask][now]+1);
				}
			}
			return dp[0][n & 1];
		};
		if(m < 23) cout << bitDP() << endl;
		else cout << brute() << endl;
		// if (n < 23) cout << brute() << endl;
		// else cout << bitDP() << endl;
	}
	return 0;
}