#include<bits/stdc++.h>
using namespace std;
//type
typedef long long ll;
using pii = pair<int, int>;
using vi = vector<int>;
//x * y * 1.0 can cause overflow
//constant
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eps 1e-10
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};
//omission
#define eb emplace_back
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define all(v) v.begin(), v.end()
//manip
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end(), v.end());
#define fill(x, y) memset(x, y, sizeof(x))
#define ceil(a, b) a / b + !!(a % b)
template<class T> T power(T a, T b)
{return b ? power(a * a % inf, b / 2) * (b % 2 ? a : 1) % inf : 1;}
#define LB(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define UB(v, x) (int)(upper_bound(v.begin(), v.end(), x) - v.begin())
//loop
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep3(i, st, n) for (int i = st; i < n; ++i)
//algorithm
//double pointer, l start, how many adds, can be 0 -> init r = l, sum = 0
//bfs, not x, y, i, j
//not !(i % 2), i % 2 == 0


int main() {
    //cast caution
    //look constraints always
    cin.tie(0); ios::sync_with_stdio(false);
    
    
    int n, m;
    while (cin >> n && n) {
        cin >> m;
        string s[n];
        rep(i, n) cin >> s[i];
        
        
        
        
        if (n < 23) {
            //mでかいと数値演算不可
            int ans = 0;
            rep(i, (1 << n)) {
                int cnt = 0; //何個のrecipe
                char tmp = '0';
                rep(k, m) { //bit毎に見る すぐ打ち切れる
                    tmp = '0';
                    rep(j, n) {
                        if (i & (1 << j)) {
                            if (tmp == s[j][k]) tmp = '0';
                            else tmp = '1';
                            
                            if (k == 0) cnt++;
                        }
                    }
                    if (tmp == '1') break;
                    
                    
                }
                
                
                if (tmp == '0') chmax(ans, cnt);
                
            }
            cout << ans << endl;
            continue;
        }
        
        
        
        
        
        //材料が22以下
        //数値演算可能
        
        //bitDP
        //memory 4 * 10^6 いける？
        
        int num[n]; fill_n(num, n, 0);
        rep(i, n) {
            for (int j = m - 1; j >= 0; --j) {
                if (s[i][j] == '1') {
                    num[i] += power(2, m - 1 - j);
                }
            }
        }
        
        //rep(i, n) cout << bitset<21>(num[i]) << " "; cout << endl;
        
        
        
        
        map<int, int> dp;
        
        rep(i, n) {
            map<int, int> dp2 = dp;
            chmax(dp[num[i]], 1);
            for (auto it : dp2) {
                int a = it.first;
                int b = it.second;
                
                if (b == 0) continue;
                
                chmax(dp[a ^ num[i]], b + 1);
            }
        }
        
        //cout << "dp " << endl;
        cout << dp[0] << endl;
        
        
        
    }
    
    
    
}
//cast caution



/*
 22 * 22 = 484
 23 * 23 = 529
 
 両方は23超えないことがわかる
 
 
 
 
 */






Measured memory_bytes: 39844