#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n; cin >> n;
    vector<P> xy(n);
    for (int i = 0; i < n; i++) cin >> xy[i].first >> xy[i].second;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            double kata = (double)abs(xy[j].second - xy[i].second) / abs(xy[j].first - xy[i].first);
            if (abs(kata) <= 1) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}
#include <bits/stdc++.h>
#include <unordered_set>
#include <cmath>
#include <algorithm>
// #include <atcoder/all>

// URL: 

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vs = vector<string>;

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n)? "YES": "NO") << endl
#define Yes(n) cout << ((n)? "Yes": "No") << endl

#define rept(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fore(x, a) for(auto& (x) : (a))

#define reptll(i, a, b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define repll(i, n) for (ll i = 0; i < (ll)(n); i++)

#define ALL(a) (a).begin(), (a).end()

#define VECCIN(x) for(auto& youso_: (x)) cin >> youso_
#define VECCOUT(x) for(auto& youso_: (x)) cout << youso_ << " ";cout << endl

#define pb push_back
#define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll INFL = numeric_limits<ll>::max() / 4;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main(){
  optimize_cin();

  ll N;
  cin >> N;

  vll A(N);
  vll C(N + 1);
  map<ll, ll> D;

  C[0] = 0;
  rep(i, N){
    cin >> A[i];
    C[i + 1] = C[i] + (i % 2 == 0? A[i] : - A[i] ); 
  }

  ll cnt = 0;
  rep(i, N + 1) {
    cnt += D[C[i]];
    D[C[i]]++;
  }

  cout << cnt << endl;

  return 0;
}