#include <bits/stdc++.h>
using namespace std;
int main()
{
    for (int N, M;;) {
        cin >> N >> M;
        if (N == 0 and M == 0) { break; }
        if (N <= 20) {
            vector<vector<int>> b(N, vector<int>(M));
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    char c;
                    cin >> c, b[i][j] = c - '0';
                }
            }
            const int MASK = 1 << N;
            int ans = 0;
            for (int mask = 0; mask < MASK; mask++) {
                int cnt = 0;
                vector<int> sum(M, 0);
                for (int i = 0; i < N; i++) {
                    if (mask & (1 << i)) {
                        cnt++;
                        for (int j = 0; j < M; j++) { sum[j] ^= b[i][j]; }
                    }
                }
                bool ok = true;
                for (int i = 0; i < M; i++) {
                    if (sum[i] == 1) { ok = false; }
                }
                if (ok) { ans = max(ans, cnt); }
            }
            cout << ans << endl;
        } else {
            vector<int> b(N, 0);
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < M; j++) {
                    char c;
                    cin >> c, b[i] |= (c - '0') << j;
                }
            }
            const int MASK = 1 << M;
            vector<int> dp(MASK, -1);
            dp[0] = 0;
            for (int i = 0; i < N; i++) {
                auto tmp = dp;
                for (int j = 0; j < MASK; j++) {
                    if (dp[j] == -1) { continue; }
                    tmp[j ^ b[i]] = max(tmp[j ^ b[i]], dp[j] + 1);
                }
                dp = tmp;
            }
            cout << dp[0] << endl;
        }
    }
    return 0;
}

