i=lambda:map(int,input().split());H,W=i();print(sum(1&sum(i())for _ in[0]*H))