description: This is the easy version of the problem. The only difference from the hard version is that in this version all coordinates are even.
  
  There are n fence-posts at distinct coordinates on a plane. It is guaranteed that no three fence posts lie on the same line.
  
  There are an infinite number of cows on the plane, one at every point with integer coordinates.
  
  Gregor is a member of the Illuminati, and wants to build a triangular fence, connecting 3 distinct existing fence posts. A cow strictly inside the fence is said to be enclosed. If there are an odd number of enclosed cows and the area of the fence is an integer, the fence is said to be interesting.
  
  Find the number of interesting fences.
  
  Input
  
  The first line contains the integer n (3 ≤ n ≤ 6000), the number of fence posts which Gregor can choose to form the vertices of a fence.
  
  Each of the next n line contains two integers x and y (0 ≤ x,y ≤ 10^7, x and y are even), where (x,y) is the coordinate of a fence post. All fence posts lie at distinct coordinates. No three fence posts are on the same line.
  
  Output
  
  Print a single integer, the number of interesting fences. Two fences are considered different if they are constructed with a different set of three fence posts.
  
  Examples
  
  Input
  
  
  3
  0 0
  2 0
  0 4
  
  
  Output
  
  
  1
  
  
  Input
  
  
  5
  0 0
  2 16
  30 14
  4 6
  2 10
  
  
  Output
  
  
  3
  
  Note
  
  In the first example, there is only 1 fence. That fence is interesting since its area is 4 and there is 1 enclosed cow, marked in red.
  
  <image>
  
  In the second example, there are 3 interesting fences. 
  
    * (0,0) — (30,14) — (2,10) 
    * (2,16) — (30,14) — (2,10) 
    * (30,14) — (4,6) — (2,10) 
solution: #include <bits/stdc++.h>
  int abs_(int a) { return a > 0 ? a : -a; }
  int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
  long long cross(int x1, int y1, int x2, int y2) {
    return (long long)x1 * y2 - (long long)x2 * y1;
  }
  int xx[6000], yy[6000];
  long long solve1(int *ii, int k) {
    static int kk[2][2];
    int h, x1, y1, x2, y2;
    long long ans;
    memset(kk, 0, sizeof kk);
    for (h = 0; h < k; h++) kk[xx[ii[h]] / 2 % 2][yy[ii[h]] / 2 % 2]++;
    ans = 0;
    for (x1 = 0; x1 < 2; x1++)
      for (y1 = 0; y1 < 2; y1++) {
        ans += (long long)kk[x1][y1] * (kk[x1][y1] - 1) * (kk[x1][y1] - 2) / 6;
        for (x2 = 0; x2 < 2; x2++)
          for (y2 = 0; y2 < 2; y2++)
            if (x2 != x1 || y2 != y1)
              ans += (long long)kk[x1][y1] * (kk[x1][y1] - 1) / 2 * kk[x2][y2];
      }
    return ans;
  }
  long long solve2(int *ii1, int k1, int *ii2, int k2, int x, int y) {
    static int kk[2][2][4], kk_[4];
    int h1, h2;
    long long ans;
    ans = 0;
    for (h2 = 0; h2 < k2; h2++) {
      int x2 = xx[ii2[h2]], y2 = yy[ii2[h2]];
      memset(kk, 0, sizeof kk), memset(kk_, 0, sizeof kk_);
      for (h1 = 0; h1 < k1; h1++) {
        int x1 = xx[ii1[h1]], y1 = yy[ii1[h1]];
        int c = (cross(x1 - x, y1 - y, x2 - x, y2 - y) % 4 + 4) % 4;
        int b = gcd(abs_(x2 - x1), abs_(y2 - y1)) % 4;
        int d = (c - b + 4) % 4, e = (-c - b + 8) % 4;
        int x = x1 / 2 % 2, y = y1 / 2 % 2;
        ans += kk_[(6 - e) % 4] - kk[x][y][(6 - e) % 4] + kk[x][y][(4 - e) % 4];
        kk[x][y][d]++, kk_[d]++;
      }
    }
    return ans;
  }
  int main() {
    static int ii[2][2][6000], kk[2][2];
    int n, i, x, y, x_, y_;
    long long ans;
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d%d", &x, &y);
      xx[i] = x, yy[i] = y, x %= 2, y %= 2;
      ii[x][y][kk[x][y]++] = i;
    }
    ans = 0;
    for (x = 0; x < 2; x++)
      for (y = 0; y < 2; y++) {
        ans += solve1(ii[x][y], kk[x][y]);
        for (x_ = 0; x_ < 2; x_++)
          for (y_ = 0; y_ < 2; y_++)
            if (x_ != x || y_ != y)
              ans += solve2(ii[x][y], kk[x][y], ii[x_][y_], kk[x_][y_], x, y);
      }
    printf("%lld\n", ans);
    return 0;
  }
  