// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	while(cin>>n>>m,n){
		vs in(n);
		rep(i,n)cin>>in[i];
		int out=0;
		if(n<m){
			int N=1<<n;
			rep(i,N){
				bool h=true;
				int co=0;
				rep(j,n)if(i&1<<j)co++;
				rep(j,m){
					int c=0;
					rep(k,n)if((i&1<<k)&&in[k][j]=='1')c++;
					if(c%2)h=false;
				}
				if(h)out=max(out,co);
			}
		}else{
			int N=1<<m;
			vi dp(N,-inf);
			dp[0]=0;
			rep(i,n){
				int t=0;
				rep(j,m)t*=2,t+=in[i][j]-'0';
				vi nd=dp;
				rep(j,N)if(dp[j]!=-inf)
					nd[j^t]=max(nd[j^t],dp[j]+1);
				dp=nd;
			}
			out=dp[0];
		}
		cout<<out<<endl;
	}
}






