#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>

using namespace std;

int n,m;
int a[500];
bool t[500][500] = {};
int dp[2][1<<24] = {};
bool m1[500] = {};
vector<int> aa;

int ns(int k, int b){
  int ret = 0;
  return ret;
}

int main(){
  while(cin >> n >> m && n != 0){
    int ans = 0;
    for(int i = 0; i < n ; i++){
      string s; cin >> s;
      for(int j = 0; j < m ; j++){
        t[i][j] = stoi(s.substr(j,1));
      }
    }
    if(n < 22){
      for(int i = 0; i < (1<<n) ; i++){
        int cnt = 0;
        for(int j = 0; j < m; j++) m1[j] = false;
        for(int j = 0; j < n; j++){
          if(i & (1<<j)){
            cnt++;
            for(int k = 0; k < m ; k++){
              if(t[j][k]) m1[k] = !m1[k];
            }
          }
        }
        bool f = true;
        for(int i = 0; i < m; i++){
          if(m1[i] == true) f = false;
        }
        if(f) ans = max(ans, cnt);
      }
    }
    else{
      for(int i = 0; i < 2; i++){
        for(int j = 0; j < (1<<m); j++){
          dp[i][j] = -1;
        }
      }
      dp[0][0] = 0;
      bool f = 1;
      for(int i = 0; i < n ; i++){
        int tmp = 0;
        for(int k = 0; k < m; k++) if(t[i][k] == 1) tmp += (1<<k);
        for(int j = 0; j < (1<<m) ; j++){
          if(dp[!f][j] >= 0){
            int x = j ^ tmp;
            dp[f][x] = max(dp[!f][j] + 1, dp[f][x]);
            dp[f][j] = max(dp[!f][j], dp[f][j]);
          }
        }
        f = !f;
      }
      ans = dp[!f][0];
    }
    aa.push_back(ans);
//    cout << ans << endl;
  }
  for(int i = 0; i < aa.size(); i++) cout << aa[i] << endl;
}

