#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<20;

int sum[501];
int b[501][501];
int n,m;

int dfs(int k,int num){
    if(k==n){
        for (int i = 0; i < m; i++) {
            if(sum[i]%2) return 0;
        }
        return num;
    }
    int ret = dfs(k+1,num);
    for (int i = 0; i < m; i++) {
        sum[i] ^= b[k][i];
    }
    ret = max(ret,dfs(k+1,num+1));
    for (int i = 0; i < m; i++) {
        sum[i] ^= b[k][i];
    }
    return ret;
}

int main(){
    while(cin >> n >> m){
        if(!n&&!m) break;
        string s[n];
        for (int i = 0; i < n; i++) {
            cin >> s[i];
        }
        memset(b,0,sizeof(b));
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if(s[i][j]=='1') b[i][j] = 1;
            }
        }
        if(m<n){
            vector<vector<int>> dp(2,vector<int>(1<<(m+1),-1));
            vector<int> x(n+1,0);
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if(b[i][j]) x[i]+=(1<<j);
                }
            }
            dp[0][0] = 0;
            for (int i = 0; i < n; i++) {
                for (int k = 0; k < (1<<m); k++) {
                    if(dp[0][k]==-1) continue;
                    int nx = k^x[i];
                    dp[1][k] = max(dp[0][k],dp[1][k]);
                    dp[1][nx] = max(dp[1][nx],dp[0][k]+1);
                }
                dp[0] = dp[1];
            }
            cout << dp[0][0] << endl;
        }
        else{
            cout << dfs(0,0) << endl;
        }
    }
    return 0;
}

