#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <random>
#include <queue>
#include <stack>
#include <bitset>
#include <cassert>
#include <unordered_map>
#include <iomanip>
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define srep(i,n,m) for(int i=n;i<m;i++)
#define elif else if
#define pi 3.141592653589793
#define prique priority_queue
constexpr auto mod=1000000007;
constexpr auto MOD=1000000000000000;
using namespace std;
int gcd(int a,int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
void syou(int a,double b){
    cout<<setprecision(a)<<b<<endl;
}
bool prime(int n){
    int cnt=0;
    for(int i=1;i<=sqrt(n);i++){
        if(n%1==0)cnt++;
    }
    if(cnt!=1) return false;
    else return n!=1;
}
struct UnionFind{
    vector<int> r;
    UnionFind(int N){
        r=vector<int>(N,-1);
    }
    int root(int x){
        if(r[x]<0) return x;
        return r[x]=root(r[x]);
    }
    bool unite(int x,int y){
        x=root(x);
        y=root(y);
        if(x==y) return false;
        if(r[x]>r[y]) swap(x,y);
        r[x]+=r[y];
        r[y]=x;
        return true;
    }
    int size(int x){
        return -r[root(x)];
    }
};
struct Edge{
    int to;
    int weight;
};
vector<int> v;
int n=0,m=0,cnt=0,ans=0,aa[220000];
pair<int,int> pp[220000];
string s,ss[220000],sa;
queue<int> que;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>pp[i].first>>pp[i].second;
    }
    rep(i,n){
        rep(j,i){
            if(abs(pp[i].first-pp[j].first)>=abs(pp[i].second-pp[j].second)){
                cnt++;
            }
        }
    }
    cout<<cnt<<endl;
}
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 nn, mm, ans = 0;
	cin >> nn >> mm;
	vector<int64> memo(nn, 0);
	string ss;
	for(int64 ii = 0;ii < nn;ii++)
	{
		cin >> ss;
		for(int64 jj = 0;jj < mm;jj++)
		{
			if(ss[jj] == '1')
			{
				memo[ii] += (1ll << jj);
			}
		}
	}
	for(int64 ii = 0;ii < nn;ii++)
	{
		int64 tmp = bitset<21>(memo[ii]).count();
		if(tmp % 2 == 1)
		{
			ans++;
		}
	}
	cout << ans * (nn - ans) << endl;
	return 0;
}