#include<bits/stdc++.h>
#define Withers using
#define AK namespace
#define IOI std
Withers AK IOI;typedef long long ll;typedef pair<int,int>pii;int n,m,u,v,w,x,y,z,l,r,minn=INT_MAX,maxx=INT_MIN,k;int tst;int a[200010];char s[200010];mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());char t[200010];
#define infll 0x3f3f3f3f3f3f3f3f
#define inf 0x3f3f3f3f
#define endl '\n'
static char buf[1<<18],*paa=buf,*pddd=buf;static char buf2[1<<18],*pppp=buf2;
#define getchar()paa==pddd&&(pddd=(paa=buf)+fread(buf,1,1<<18,stdin),paa==pddd)?EOF:*paa++
inline void pc(char ch){if(pppp-buf2==1<<18)fwrite(buf2,1,1<<18,stdout),pppp=buf2;*pppp++=ch;}inline void pcc(){fwrite(buf2,1,pppp-buf2,stdout);pppp=buf2;}inline void rd(int&n){int w=1;register int x(0);register char c(getchar());while(c<'0'||c>'9'){if(c=='-')w=-1;c=getchar();}while(c>='0'&&c<='9')x=(x<<1)+(x<<3)+(c^48),c=getchar();n=w*x;return;}inline void write(int x){if(x<0)pc('-'),x=-x;static int sta[20];int top=0;do{sta[top++]=x%10,x/=10;}while(x);while(top)pc(sta[--top]+48);}inline void we(int x){write(x);pc('\n');}inline void ws(int x){write(x);pc(' ');}
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define deb(x)cout<<#x<<"="<<x<<" ";
#define pb push_back
#define fi first
#define se second
#define mx3(a,b,c)((a>b?a:b)>c?(a>b?a:b):c)
#define mn3(a,b,c)((a<b?a:b)<c?(a<b?a:b):c)
#define mem(a,b)memset(a,b,sizeof(a))
#define rep(i,a,b)for(int i=a;i<=b;i++)
map<tuple<int, int, int>, int> mp;
int c[2010][2010];
void solve()
{
//do something
rd(n),rd(m);
rep(i,1,n) rep(j,1,m) rd(c[i][j]);
int as=0;
rep(i,1,n)
{
rep(j,i+1,n)
{
int cnt=0;
rep(k,1,m) if(c[i][k]==c[j][k]) ++cnt;
if(cnt%2==1) ++as;
}
}
cout<<as<<endl;
}
void multi()
{
//rd(tst);
tst=1;
while(tst--)
{
solve();
}
pcc();
}
signed main()
{
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
multi();
}
// POWERED BY WITHERS
// THINK ONCE, CODE TWICE
/*things to check
1. int overflow or long long memory need
2. recursion/array/binary search/dp/loop bounds
3. precision
4. special cases(n=1,bounds)
5. delete debug statements
6. initialize(especially multi-tests)
7. = or == , n or m ,++ or -- , i or j , > or >= , < or <= , - or =
8. keep it simple and stupid
9. do not delete, use // instead
10. operator priority
11. is there anything extra to output?
12. if you don't know where the bug is , try to clear some parts of the code
and check each part seperately.
13. ...
*/
/* something to think about
1. greedy? dp? searching? dp with matrix/ segment tree? binary search?
2. If contains "not", why not 正难则反 or few affect?
*/
// lgvc bilibilitdasc zxx zy graygoo tt cyx wsc akioi!