#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
#define maxn 1505
#define lg 31
ll n,m;
ll a[maxn][maxn];
int main()
{
    ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); cerr.tie(0);
    cin >> n >> m;
    for(ll i = 1;i<=n;i++) for(ll j = 1;j<=m;j++) cin >> a[i][j];
    ll sum = 0,ans = 0;
    for(ll k = 0;k<lg;k++){
        for(ll i = 1;i<=n;i++) for(ll j = 1;j<=m;j++){
            if((1<<k)&a[i][j]) sum^=1;
        }
        if(sum) ans+=(1<<k);
        sum = 0;
    }
    cout<<ans<<endl;
    return 0;
}