while 1:

    n, m = list(map(int, input().split()))

    if n+m == 0:

        break

    B = [int(eval(input()),2) for i in range(n)]

    C = {0: 0}

    for b in B:

        D = dict(C)

        for k, v in list(D.items()):

            C[k^b] = max(C.get(k^b, 0), v+1)

    print((C[0]))
while 1:

    n, m = list(map(int, input().split()))

    if n+m == 0:

        break

    C = {0: 0}

    for i in range(n):

        b = int(eval(input()), 2)

        for k, v in list(dict(C).items()):

            if C.get(k^b, 0) < v+1:

                C[k^b] = v+1

    print((C[0]))
while 1:
    n, m = list(map(int, input().split()))
    if n + m == 0:
        break
    B = [int(eval(input()), 2) for i in range(n)]
    C = {0: 0}
    for b in B:
        D = dict(C)
        for k, v in list(D.items()):
            C[k ^ b] = max(C.get(k ^ b, 0), v + 1)
    print((C[0]))

while 1:
    n, m = list(map(int, input().split()))
    if n + m == 0:
        break
    C = {0: 0}
    for i in range(n):
        b = int(eval(input()), 2)
        for k, v in list(dict(C).items()):
            if C.get(k ^ b, 0) < v + 1:
                C[k ^ b] = v + 1
    print((C[0]))

-    B = [int(eval(input()), 2) for i in range(n)] -    for b in B: -        D = dict(C) -        for k, v in list(D.items()): -            C[k ^ b] = max(C.get(k ^ b, 0), v + 1) +    for i in range(n): +        b = int(eval(input()), 2) +        for k, v in list(dict(C).items()): +            if C.get(k ^ b, 0) < v + 1: +                C[k ^ b] = v + 1