#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
#define inf 1e9


int main(){
    while(1){
	int n,m;
	cin>>n>>m;
	if(n==0)break;
	vector<vector<int> > b(n,vector<int>(m,0));
	bitset<512> bits[512];
	for(int i=0;i<n;i++){
	    string s;
	    cin>>s;
	    for(int j=0;j<m;j++){
		b[i][j] = s[j]-'0';
		bits[i][j] = b[i][j];
	    }
	}
	if(n <= m ){
	    ll res = 0;
	    for(int i=0;i<(1<<n);i++){
	    	bitset<512> bit;
		ll cnt = 0;
		for(int j=0;j<n;j++){
		    if( (i>>j) & 1 ){
			cnt++;
			bit ^= bits[j];
		    }
		}
		if( bit.count() == 0 ){
		    res = max(res,cnt);
		}
	    }
	    cout<<res<<endl;
	}else{
	    vector<vector<ll> > dp( 2,vector<ll> ( 1<<m , -1 ) );
	    dp[0][0] = 0;
	    vector<ll> num(n,0);
	    //cout<< ( 1<<m ) <<endl;
	    for(int i=0;i<n;i++)for(int j=0;j<m;j++) num[i] |= b[i][j]<<j;
	    for(int i=0;i<n;i++){
		for(int j=0;j< (1<<m) ; j++){
		    if( dp[ i%2 ][j] < 0 ) continue;
		    dp[ (i+1)%2 ][j] = max( dp[ (i+1)%2 ] [j] , dp[i%2][j] );
		    //cout<<(j^num[i])<<endl;
		    dp[ (i+1)%2 ][ j^num[i] ] = max( dp[ (i+1)%2 ][j^num[i] ] ,dp[i%2][j] + 1);
		    dp[i%2][j] = -1;
		}
	    }
	    cout<<dp[n%2][0]<<endl;
	}
    }
    return 0;
}

