n, c = map(int,input().split())
xosa = []
yosa = []
tr = 0
br = 0
ar = 0
cr = 0
for i in range(n):
    x , y = map(int,input().split())
    xosa.append(x)
    yosa.append(y)
    if(x%2==0):
        br = br + 1
    else:
        tr = tr + 1
    if(y%2==0):
        ar = ar + 1
    else:
        cr = cr + 1

print(max(ar,cr,br,tr))