#include<bits/stdc++.h>

using namespace std;


int main(){

    int n;
    cin>>n;

    pair<int,int> points[n];
    for(int i=0;i<n;i++){
        cin>>points[i].first>>points[i].second;
    }
    int freq=0;
    for(int i=0;i<n;i++){
            int j=n-1;
      while(j>i){
            float a=(points[j].second)-(points[i].second);
      float b=(points[j].first)-(points[i].first);
        float s=a/b;


        if(s<=1&&s>=-1){freq++;}
        j--;}}

        cout<<freq;

    return 0;}










#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

int main() {
  int n;
  cin >> n;
  ll ans = 0;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    ans += (ll)(a + b) * (b - a + 1) / 2;
  }
  cout << ans << endl;
  return 0;
}
