#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x >= 0 && y < 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  for (int i = 1; i <= n; ++i) {
    st[i].read();
  }
  sort(st + 1, st + n + 1);
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
  long long add = 0;
  for (int l = 1, r = 1, cr, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    if (st[l].quo() == st[r].quo()) {
      cr = r;
    }
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x >= 0 && y < 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

bool in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  return sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
}

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  srand(time(NULL));
//  n = 70; c = 0; d = 0;
  for (int i = 1; i <= n; ++i) {
    st[i].read();
//    st[i].r = rand() % 10000 - rand() % 20000;
//    st[i].w = rand() % 10000 - rand() % 20000;
//    st[i].x = st[i].r - c;
//    st[i].y = st[i].w - d;
  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }
  int ret = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = i + 1; k <= n; ++k) {
        if (k == j) {
          continue;
        }
        if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
          ++ret;
        }
      }
    }
  }
  cout << ret << endl;*/
  sort(st + 1, st + n + 1);
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]);
        }
      }
    }
  }
  cout << ans / 6 << endl;
  for (int l = 1, r = 1; l <= n; ++l) {
    r = max(r, l);
    while (r + 1 < l + n && !in(st[l], st[r], st[r + 1])) {
      r++;
    }
    if (in(st[l], st[r], st[r + 1])) {
      int cnt = max(0, r - l - 1);
      total -= 1LL * cnt * (cnt + 1) / 2;
    } else {
      total -= 1LL * (n - 2) * (n - 1) / 2;
    }
  }
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x >= 0 && y < 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

bool in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  return sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
}

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  for (int i = 1; i <= n; ++i) {
    st[i].read();
    st[i].r -= c;
    st[i].w -= d;
  }
/*  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = i + 1; k <= n; ++k) {
        if (k == j) {
          continue;
        }
        if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
          cout << 1LL * (st[i].r - c) * (st[j].w - d) << ' ' << 1LL * (st[j].r - c) * (st[i].w - d) << endl;
          cout << 1LL * (st[j].r - c) * (st[k].w - d) << ' ' << 1LL * (st[k].r - c) * (st[j].w - d) << endl;
          cout << 1LL * (st[k].r - c) * (st[i].w - d) << ' ' << 1LL * (st[i].r - c) * (st[k].w - d) << endl;
        }
      }
    }
  }
*/
  sort(st + 1, st + n + 1);
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
/*  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]);
        }
      }
    }
  }
  cout << ans << endl;*/
  for (int l = 1, r = 1; l <= n; ++l) {
    r = max(r, l);
    while (r < l + n && !in(st[l], st[r], st[r + 1])) {
      r++;
    }
    int cnt = max(0, r - l - 1);
    total -= 1LL * cnt * (cnt + 1) / 2;
  }
  cout << total << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  bool operator< (const Student &other) const {
//    if (quo() != other.quo()) {
//      return quo() < other.quo();
//    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

char in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  bool ok = sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
  if (!ok) {
    return 0;
  }
  if (abs(1LL * a.x * b.y - 1LL * a.y * b.x) != 0 &&
    abs(1LL * a.x * c.y - 1LL * a.y * c.x) != 0 &&
    abs(1LL * b.x * c.y - 1LL * b.y * c.x) != 0) {
    return 2;
  }
  return 1;
}

bool g(const Student &a, const Student &b) {
  double A = hypot(a.x, a.y), B = hypot(b.x, b.y);
  double C = hypot(a.x - b.x, a.y - b.y);
  return abs(min(A, B) + C - max(A, B)) < 1e-9;
}

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  srand(time(NULL));
//  n = 100; c = rand() % 100; d = rand() % 100;
//  set < pair < int, int > > me;
//  me.insert(make_pair(0, 0));
  for (int i = 1; i <= n; ++i) {
    st[i].read();
/*    st[i].r = rand() % 1000;
    st[i].w = (i <= 20 ? 0 : rand() % 5000);
    if (me.count(make_pair(st[i].r, st[i].w))) {
      --i;
      continue;
    }
    me.insert(make_pair(st[i].r, st[i].w));
    st[i].x = st[i].r - c;    st[i].y = st[i].w - d;*/
  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }*/
  if (n <= 2000) {
    long long ret = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i + 1; k <= n; ++k) {
          if (k == j) {
            continue;
          }
          if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
            ++ret;
          }
        }
      }
    }
    cout << ret << endl;
    exit(0);
  }
  sort(st + 1, st + n + 1);
 // for (int i = 1; i <= n; ++i) {
 //   cout << st[i].x << ' ' << st[i].y << endl;
 // }
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
/*  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]) == 2;
//          if (in(st[i], st[j], st[k]) == 2) {
//            cout << st[i].x << ' ' << st[i].y << ' ' << st[j].x << ' ' << st[j].y << ' ' << st[k].x << ' ' << st[k].y << endl;
//          }
        }
      }
    }
  }
  cout << ans << endl;*/
  long long add = 0;
  for (int l = 1, r = 1, cr = 0, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0) {
//      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0 && g(st[l], st[r + 1])) {
      r++;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    if (st[l].x < 0 || st[l].x == 0 && st[l].y < 0) {
      total += 1LL * (r - cr - 1) * (r - cr) / 2;
    }
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x <= 0 && y > 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
//    if (quo() != other.quo()) {
//      return quo() < other.quo();
//    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

char in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  bool ok = sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
  if (!ok) {
    return 0;
  }
  if (abs(1LL * a.x * b.y - 1LL * a.y * b.x) != 0 &&
    abs(1LL * a.x * c.y - 1LL * a.y * c.x) != 0 &&
    abs(1LL * b.x * c.y - 1LL * b.y * c.x) != 0) {
    return 2;
  }
  return 1;
}

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  srand(time(NULL));
//  n = 100; c = rand() % 100; d = rand() % 100;
  set < pair < int, int > > me;
  me.insert(make_pair(0, 0));
  for (int i = 1; i <= n; ++i) {
    st[i].read();
//    st[i].r = rand() % 1000;
//    st[i].w = (i <= 20 ? 0 : rand() % 5000);
//    if (me.count(make_pair(st[i].r, st[i].w))) {
//      --i;
//      continue;
//    }
//    me.insert(make_pair(st[i].r, st[i].w));
//    st[i].x = st[i].r - c;    st[i].y = st[i].w - d;
  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }*/
/*  if (n <= 200) {
    long long ret = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i + 1; k <= n; ++k) {
          if (k == j) {
            continue;
          }
          if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
            ++ret;
          }
        }
      }
    }
    cout << ret << endl;
  }*/
  sort(st + 1, st + n + 1);
 // for (int i = 1; i <= n; ++i) {
 //   cout << st[i].x << ' ' << st[i].y << endl;
 // }
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
/*  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]) == 2;
//          if (in(st[i], st[j], st[k]) == 2) {
//            cout << st[i].x << ' ' << st[i].y << ' ' << st[j].x << ' ' << st[j].y << ' ' << st[k].x << ' ' << st[k].y << endl;
//          }
        }
      }
    }
  }
  cout << ans << endl;*/
  long long add = 0;
  for (int l = 1, r = 1, cr = 0, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && st[l].quo() == st[r + 1].quo() && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x >= 0 && y < 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  for (int i = 1; i <= n; ++i) {
    st[i].read();
  }
  sort(st + 1, st + n + 1);
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
  long long add = 0;
  for (int l = 1, r = 1, cr, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y == 0) {
      return 0;
    }
    if (x > 0 && y > 0) {
      return 1;
    }
    if (x == 0 && y > 0) {
      return 2;
    }
    if (x < 0 && y > 0) {
      return 3;
    }
    if (x < 0 && y == 0) {
      return 4;
    }
    if (x < 0 && y < 0) {
      return 5;
    }
    if (x == 0 && y < 0) {
      return 6;
    }
    return 7;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

char in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  bool ok = sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
  if (!ok) {
    return 0;
  }
  if (abs(1LL * a.x * b.y - 1LL * a.y * b.x) != 0 &&
    abs(1LL * a.x * c.y - 1LL * a.y * c.x) != 0 &&
    abs(1LL * b.x * c.y - 1LL * b.y * c.x) != 0) {
    return 2;
  }
  return 1;
}

bool g(const Student &a, const Student &b) {
  double A = hypot(a.x, a.y), B = hypot(b.x, b.y);
  double C = hypot(a.x - b.x, a.y - b.y);
  return abs(min(A, B) + C - max(A, B)) < 1e-9;
}

bool DEBUG = false;

int main() {
if (!DEBUG) {
//  freopen("input.txt", "r", stdin);
}
if (!DEBUG) {
  scanf("%d%d%d", &n, &c, &d);
} else {
  srand(time(NULL));
  n = 100; c = 0; d = 0;
}
  set < pair < int, int > > me;
  me.insert(make_pair(0, 0));
  for (int i = 1; i <= n; ++i) {
if (!DEBUG) {
    st[i].read();
} else {
    st[i].r = rand() % 30 - 15;
    if (i > 20 && i <= 40) {
      st[i].r = 0;
    }
    st[i].w = (i <= 20 ? 0 : rand() % 30 - 15);
    if (me.count(make_pair(st[i].r, st[i].w))) {
      --i;
      continue;
    }
    me.insert(make_pair(st[i].r, st[i].w));
}
    st[i].x = st[i].r - c;    st[i].y = st[i].w - d;

  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }*/
if (!DEBUG) {
  if (n <= 2000) {
    long long ret = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i + 1; k <= n; ++k) {
          if (k == j) {
            continue;
          }
          if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
            ++ret;
          }
        }
      }
    }
    cout << ret << endl;
    exit(0);
  }
}
  sort(st + 1, st + n + 1);
 // for (int i = 1; i <= n; ++i) {
 //   cout << st[i].x << ' ' << st[i].y << endl;
 // }
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
if (DEBUG) {
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]) == 2;
//          if (in(st[i], st[j], st[k]) == 2) {
//            cout << st[i].x << ' ' << st[i].y << ' ' << st[j].x << ' ' << st[j].y << ' ' << st[k].x << ' ' << st[k].y << endl;
//          }
        }
      }
    }
  }
  cout << ans << endl;
}
  long long add = 0;
  for (int l = 1, r = 1, cr = 0, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0 && g(st[l], st[l - 1])) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0 && g(st[l], st[r + 1])) {
      r++;
    }
    int fl = 0;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
      fl++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
if (DEBUG) {
  if (0 != max(total, 0LL)) {
    freopen("input.txt", "w", stdout);
    cout << 100 << ' ' << 0 << ' ' << 0 << endl;
    for (int i = 1; i <= n; ++i) {
      cout << st[i].r << ' ' << st[i].w << endl;
    }
    throw;
  }
}
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

extern "C" {
#include <quadmath.h>
}

using namespace std;

const int MaxN = 1e5 + 10;
const int INF = 1e9;

int main() {
//  freopen("input.txt", "r", stdin);
  int n, c, d;
  scanf("%d%d%d", &n, &c, &d);
  vector < __float128 > ang;
  ang.reserve(3 * n);
  __float128 pi = acos((long double)-1.0);
  for (int i = 1; i <= n; ++i) {
    double x, y;
    scanf("%lf%lf", &x, &y);
    x -= c;
    y -= d;
    ang.push_back(atan2((long double)y, (long double)x));
  }
  sort(ang.begin(), ang.end());
  for (int i = 0; i < 2 * n; ++i) {
    ang.push_back(ang[i] + 2 * pi);
  }
  long long ans = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int l = 0, r = 0, cr = 0; l < n; ++l) {
    r = max(l, r);
    while (ang[r + 1] - ang[l] < pi + (__float128)1e-18) {
      r++;
    }
    while (ang[cr] - ang[l] < pi - (__float128)1e-18) {
      cr++;
    }
    ans -= 1LL * (r - l) * (r - l - 1) / 2 - 1LL * (r - cr) * (r - cr + 1) / 2;
  }
  cout << ans << '\n';
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x >= 0 && y < 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

bool in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  return sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
}

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  srand(time(NULL));
//  n = 70; c = 0; d = 0;
  for (int i = 1; i <= n; ++i) {
    st[i].read();
//    st[i].r = rand() % 10000 - rand() % 20000;
//    st[i].w = rand() % 10000 - rand() % 20000;
//    st[i].x = st[i].r - c;
//    st[i].y = st[i].w - d;
  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }
  int ret = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = i + 1; k <= n; ++k) {
        if (k == j) {
          continue;
        }
        if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
          ++ret;
        }
      }
    }
  }
  cout << ret << endl;*/
  sort(st + 1, st + n + 1);
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]);
        }
      }
    }
  }
  cout << ans / 6 << endl;
  return 0;
  for (int l = 1, r = 1; l <= n; ++l) {
    r = max(r, l);
    while (r + 1 < l + n && !in(st[l], st[r], st[r + 1])) {
      r++;
    }
    if (in(st[l], st[r], st[r + 1])) {
      int cnt = max(0, r - l - 1);
      total -= 1LL * cnt * (cnt + 1) / 2;
    } else {
      total -= 1LL * (n - 2) * (n - 1) / 2;
    }
  }
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y == 0) {
      return 0;
    }
    if (x > 0 && y > 0) {
      return 1;
    }
    if (x == 0 && y > 0) {
      return 2;
    }
    if (x < 0 && y > 0) {
      return 3;
    }
    if (x < 0 && y == 0) {
      return 4;
    }
    if (x < 0 && y < 0) {
      return 5;
    }
    if (x == 0 && y < 0) {
      return 6;
    }
    return 7;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

char in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  bool ok = sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
  if (!ok) {
    return 0;
  }
  if (abs(1LL * a.x * b.y - 1LL * a.y * b.x) != 0 &&
    abs(1LL * a.x * c.y - 1LL * a.y * c.x) != 0 &&
    abs(1LL * b.x * c.y - 1LL * b.y * c.x) != 0) {
    return 2;
  }
  return 1;
}

bool g(const Student &a, const Student &b) {
  double A = hypot(a.x, a.y), B = hypot(b.x, b.y);
  double C = hypot(a.x - b.x, a.y - b.y);
  return abs(min(A, B) + C - max(A, B)) < 1e-9;
}

bool DEBUG = false;

int main() {
if (!DEBUG) {
//  freopen("input.txt", "r", stdin);
}
if (!DEBUG) {
  scanf("%d%d%d", &n, &c, &d);
} else {
  srand(time(NULL));
  n = 100; c = 0; d = 0;
}
  set < pair < int, int > > me;
  me.insert(make_pair(0, 0));
  for (int i = 1; i <= n; ++i) {
if (!DEBUG) {
    st[i].read();
} else {
    st[i].r = rand() % 30 - 15;
    if (i > 20 && i <= 40) {
      st[i].r = 0;
    }
    st[i].w = (i <= 20 ? 0 : rand() % 30 - 15);
    if (me.count(make_pair(st[i].r, st[i].w))) {
      --i;
      continue;
    }
    me.insert(make_pair(st[i].r, st[i].w));
}
    st[i].x = st[i].r - c;    st[i].y = st[i].w - d;

  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }*/
if (DEBUG) {
  if (n <= 2000) {
    long long ret = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i + 1; k <= n; ++k) {
          if (k == j) {
            continue;
          }
          if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
            ++ret;
          }
        }
      }
    }
    cout << ret << endl;
  }
}
  sort(st + 1, st + n + 1);
 // for (int i = 1; i <= n; ++i) {
 //   cout << st[i].x << ' ' << st[i].y << endl;
 // }
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
if (DEBUG) {
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]) == 2;
//          if (in(st[i], st[j], st[k]) == 2) {
//            cout << st[i].x << ' ' << st[i].y << ' ' << st[j].x << ' ' << st[j].y << ' ' << st[k].x << ' ' << st[k].y << endl;
//          }
        }
      }
    }
  }
  cout << ans << endl;
}
  long long add = 0;
  for (int l = 1, r = 1, cr = 0, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0 && g(st[l], st[r + 1])) {
      r++;
    }
    int fl = 0;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
      fl++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    if (!fl) {
      cr = r;
    }
    cnt = r - l;
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
if (DEBUG) {
  if (0 != max(total, 0LL)) {
    freopen("input.txt", "w", stdout);
    cout << 100 << ' ' << 0 << ' ' << 0 << endl;
    for (int i = 1; i <= n; ++i) {
      cout << st[i].r << ' ' << st[i].w << endl;
    }
    throw;
  }
}
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  double ang;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool operator< (const Student &other) const {
    return atan2(y + .0, x + .0) < atan2(other.y + .0, other.x + .0);
  }
} st[MaxN];

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  for (int i = 1; i <= n; ++i) {
    st[i].read();
  }
  sort(st + 1, st + n + 1);
  double pi = acos(-1.0);
  for (int i = 1; i < MaxN - n; ++i) {
    if (i <= n) {
      st[i].ang = atan2(st[i].y + .0, st[i].x + .0);
    } else {
      st[i].ang = st[i - n].ang + 2 * pi;
    }
  }
  long long ans = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int l = 1, r = 1, up = 1, dw = 1; l <= n; ++l) {
    r = max(r, l);
    while (st[r + 1].ang - st[l].ang <= pi) {
      r++;
    }
    while (st[dw].ang - st[l].ang < pi) {
      dw++;
    }
    while (st[up].ang - st[l].ang <= pi) {
      up++;
    }
    ans -= 1LL * (r - l) * (r - l - 1) / 2 - 1LL * (up - dw) * (up - dw - 1) / 2;
  }
  cout << ans << '\n';
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  double ang;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool operator< (const Student &other) const {
    return atan2(y + .0, x + .0) < atan2(other.y + .0, other.x + .0) || atan2(y + .0, x + .0) == atan2(other.y + .0, other.x + .0) && x < other.x;
  }
} st[MaxN];

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  for (int i = 1; i <= n; ++i) {
    st[i].read();
  }
  sort(st + 1, st + n + 1);
  double pi = acos(-1.0);
  for (int i = 1; i < MaxN; ++i) {
    if (i <= n) {
      st[i].ang = atan2(st[i].y + .0, st[i].x + .0);
    } else {
      st[i].ang = st[i - n].ang + 2 * pi;
    }
  }
  long long ans = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int l = 1, r = 1, up = 1, dw = 1; l <= n; ++l) {
    r = max(r, l);
    while (st[r + 1].ang - st[l].ang < pi + 1e-19) {
      r++;
    }
    while (st[dw].ang - st[l].ang < pi - 1e-19) {
      dw++;
    }
    while (st[up].ang - st[l].ang < pi + 1e-19) {
      up++;
    }
    ans -= 1LL * (r - l) * (r - l - 1) / 2 - 1LL * (up - dw) * (up - dw - 1) / 2;
  }
  cout << ans << '\n';
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x >= 0 && y < 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

bool in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  return sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
}

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  srand(time(NULL));
//  n = 70; c = 0; d = 0;
  for (int i = 1; i <= n; ++i) {
    st[i].read();
//    st[i].r = rand() % 10000 - rand() % 20000;
//    st[i].w = rand() % 10000 - rand() % 20000;
//    st[i].x = st[i].r - c;
//    st[i].y = st[i].w - d;
  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }
  int ret = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = i + 1; k <= n; ++k) {
        if (k == j) {
          continue;
        }
        if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
          ++ret;
        }
      }
    }
  }
  cout << ret << endl;*/
  sort(st + 1, st + n + 1);
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
/*  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]);
        }
      }
    }
  }
  cout << ans / 6 << endl;*/
  for (int l = 1, r = 1; l <= n; ++l) {
    r = max(r, l);
    while (r + 1 < l + n && !in(st[l], st[r], st[r + 1])) {
      r++;
    }
    if (in(st[l], st[r], st[r + 1])) {
      int cnt = max(0, r - l - 1);
      total -= 1LL * cnt * (cnt + 1) / 2;
    } else {
      total -= 1LL * (n - 2) * (n - 1) / 2;
    }
  }
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y >= 0) {
      return 3;
    }
    if (x <= 0 && y > 0) {
      return 2;
    }
    if (x < 0 && y <= 0) {
      return 1;
    }
    return 0;
  }
  bool operator< (const Student &other) const {
//    if (quo() != other.quo()) {
//      return quo() < other.quo();
//    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

char in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  bool ok = sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
  if (!ok) {
    return 0;
  }
  if (abs(1LL * a.x * b.y - 1LL * a.y * b.x) != 0 &&
    abs(1LL * a.x * c.y - 1LL * a.y * c.x) != 0 &&
    abs(1LL * b.x * c.y - 1LL * b.y * c.x) != 0) {
    return 2;
  }
  return 1;
}

int main() {
//  freopen("input.txt", "r", stdin);
  scanf("%d%d%d", &n, &c, &d);
  srand(time(NULL));
//  n = 100; c = rand() % 100; d = rand() % 100;
  set < pair < int, int > > me;
  me.insert(make_pair(0, 0));
  for (int i = 1; i <= n; ++i) {
    st[i].read();
//    st[i].r = rand() % 1000;
//    st[i].w = (i <= 20 ? 0 : rand() % 5000);
//    if (me.count(make_pair(st[i].r, st[i].w))) {
//      --i;
//      continue;
//    }
//    me.insert(make_pair(st[i].r, st[i].w));
//    st[i].x = st[i].r - c;    st[i].y = st[i].w - d;
  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }*/
/*  if (n <= 200) {
    long long ret = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i + 1; k <= n; ++k) {
          if (k == j) {
            continue;
          }
          if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
            ++ret;
          }
        }
      }
    }
    cout << ret << endl;
  }*/
  sort(st + 1, st + n + 1);
 // for (int i = 1; i <= n; ++i) {
 //   cout << st[i].x << ' ' << st[i].y << endl;
 // }
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
/*  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]) == 2;
//          if (in(st[i], st[j], st[k]) == 2) {
//            cout << st[i].x << ' ' << st[i].y << ' ' << st[j].x << ' ' << st[j].y << ' ' << st[k].x << ' ' << st[k].y << endl;
//          }
        }
      }
    }
  }
  cout << ans << endl;*/
  long long add = 0;
  for (int l = 1; l <= n; ++l) {
    cout << st[l].x << ' ' << st[l].y << endl;
  }
  for (int l = 1, r = 1, cr = 0, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && st[l].quo() == st[r + 1].quo() && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y == 0) {
      return 0;
    }
    if (x > 0 && y > 0) {
      return 1;
    }
    if (x == 0 && y > 0) {
      return 2;
    }
    if (x < 0 && y > 0) {
      return 3;
    }
    if (x < 0 && y == 0) {
      return 4;
    }
    if (x < 0 && y < 0) {
      return 5;
    }
    if (x == 0 && y < 0) {
      return 6;
    }
    return 7;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

char in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  bool ok = sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
  if (!ok) {
    return 0;
  }
  if (abs(1LL * a.x * b.y - 1LL * a.y * b.x) != 0 &&
    abs(1LL * a.x * c.y - 1LL * a.y * c.x) != 0 &&
    abs(1LL * b.x * c.y - 1LL * b.y * c.x) != 0) {
    return 2;
  }
  return 1;
}

bool g(const Student &a, const Student &b) {
  double A = hypot(a.x, a.y), B = hypot(b.x, b.y);
  double C = hypot(a.x - b.x, a.y - b.y);
  return abs(min(A, B) + C - max(A, B)) < 1e-9;
}

bool DEBUG = false;

int main() {
if (!DEBUG) {
//  freopen("input.txt", "r", stdin);
}
if (!DEBUG) {
  scanf("%d%d%d", &n, &c, &d);
} else {
  srand(time(NULL));
  n = 100; c = 0; d = 0;
}
  set < pair < int, int > > me;
  me.insert(make_pair(0, 0));
  for (int i = 1; i <= n; ++i) {
if (!DEBUG) {
    st[i].read();
} else {
    st[i].r = rand() % 30 - 15;
    if (i > 20 && i <= 40) {
      st[i].r = 0;
    }
    st[i].w = (i <= 20 ? 0 : rand() % 30 - 15);
    if (me.count(make_pair(st[i].r, st[i].w))) {
      --i;
      continue;
    }
    me.insert(make_pair(st[i].r, st[i].w));
}
    st[i].x = st[i].r - c;    st[i].y = st[i].w - d;

  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }*/
if (DEBUG) {
  if (n <= 2000) {
    long long ret = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i + 1; k <= n; ++k) {
          if (k == j) {
            continue;
          }
          if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
            ++ret;
          }
        }
      }
    }
    cout << ret << endl;
  }
}
  sort(st + 1, st + n + 1);
 // for (int i = 1; i <= n; ++i) {
 //   cout << st[i].x << ' ' << st[i].y << endl;
 // }
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
if (DEBUG) {
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]) == 2;
//          if (in(st[i], st[j], st[k]) == 2) {
//            cout << st[i].x << ' ' << st[i].y << ' ' << st[j].x << ' ' << st[j].y << ' ' << st[k].x << ' ' << st[k].y << endl;
//          }
        }
      }
    }
  }
  cout << ans << endl;
}
  long long add = 0;
  for (int l = 1, r = 1, cr = 0, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0 && g(st[l], st[r + 1])) {
      r++;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
if (DEBUG) {
  if (0 != max(total, 0LL)) {
    freopen("input.txt", "w", stdout);
    cout << 100 << ' ' << 0 << ' ' << 0 << endl;
    for (int i = 1; i <= n; ++i) {
      cout << st[i].r << ' ' << st[i].w << endl;
    }
    throw;
  }
}
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <set>
#include <map>
#include <complex>
#include <iostream>
#include <time.h>
#include <math.h>
#include <stack>
#include <stdlib.h>
#include <memory.h>
#include <bitset>
#include <math.h>
#include <string>
#include <string.h>
#include <queue>
#include <vector>

using namespace std;

const int MaxN = 8e5 + 10;
const int INF = 1e9;

int n, c, d;

struct Student {
  int r, w, x, y;
  void read() {
    scanf("%d%d", &r, &w);
    x = r - c;
    y = w - d;
  }
  bool f(const Student &other) const {
    return 1LL * x * other.y > 1LL * other.x * y;
  }
  int quo() const {
    if (x > 0 && y == 0) {
      return 0;
    }
    if (x > 0 && y > 0) {
      return 1;
    }
    if (x == 0 && y > 0) {
      return 2;
    }
    if (x < 0 && y > 0) {
      return 3;
    }
    if (x < 0 && y == 0) {
      return 4;
    }
    if (x < 0 && y < 0) {
      return 5;
    }
    if (x == 0 && y < 0) {
      return 6;
    }
    return 7;
  }
  bool operator< (const Student &other) const {
    if (quo() != other.quo()) {
      return quo() < other.quo();
    }
    return 1LL * x * other.y - 1LL * y * other.x > 0;
  }
} st[MaxN];

char in(const Student &a, const Student &b, const Student &c) {
  long long sq = 0;
  sq += 1LL * (a.x - b.x) * (a.y + b.y);
  sq += 1LL * (b.x - c.x) * (b.y + c.y);
  sq += 1LL * (c.x - a.x) * (a.y + c.y);
  sq = abs(sq);
  bool ok = sq != 0 && sq == abs(1LL * a.x * b.y - 1LL * a.y * b.x) +
                abs(1LL * a.x * c.y - 1LL * a.y * c.x) +
                abs(1LL * b.x * c.y - 1LL * b.y * c.x);
  if (!ok) {
    return 0;
  }
  if (abs(1LL * a.x * b.y - 1LL * a.y * b.x) != 0 &&
    abs(1LL * a.x * c.y - 1LL * a.y * c.x) != 0 &&
    abs(1LL * b.x * c.y - 1LL * b.y * c.x) != 0) {
    return 2;
  }
  return 1;
}

bool g(const Student &a, const Student &b) {
  double A = hypot(a.x, a.y), B = hypot(b.x, b.y);
  double C = hypot(a.x - b.x, a.y - b.y);
  return abs(min(A, B) + C - max(A, B)) < 1e-9;
}

bool DEBUG = false;

int main() {
if (!DEBUG) {
//  freopen("input.txt", "r", stdin);
}
if (!DEBUG) {
  scanf("%d%d%d", &n, &c, &d);
} else {
  srand(time(NULL));
  n = 100; c = 0; d = 0;
}
  set < pair < int, int > > me;
  me.insert(make_pair(0, 0));
  for (int i = 1; i <= n; ++i) {
if (!DEBUG) {
    st[i].read();
} else {
    st[i].r = rand() % 30 - 15;
    if (i > 20 && i <= 40) {
      st[i].r = 0;
    }
    st[i].w = (i <= 20 ? 0 : rand() % 30 - 15);
    if (me.count(make_pair(st[i].r, st[i].w))) {
      --i;
      continue;
    }
    me.insert(make_pair(st[i].r, st[i].w));
}
    st[i].x = st[i].r - c;    st[i].y = st[i].w - d;

  }
/*  for (int i = 1; i <= n; ++i) {
    cout << st[i].x << ' ' << st[i].y << endl;
  }*/
if (DEBUG) {
  if (n <= 2000) {
    long long ret = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i + 1; k <= n; ++k) {
          if (k == j) {
            continue;
          }
          if (st[i].f(st[j]) && st[j].f(st[k]) && st[k].f(st[i])) {
            ++ret;
          }
        }
      }
    }
    cout << ret << endl;
  }
}
  sort(st + 1, st + n + 1);
 // for (int i = 1; i <= n; ++i) {
 //   cout << st[i].x << ' ' << st[i].y << endl;
 // }
  long long total = 1LL * n * (n - 1) * (n - 2) / 6;
  for (int i = 1; i <= n; ++i) {
    st[i + n].x = st[i].x;
    st[i + n].y = st[i].y;
  }
if (DEBUG) {
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      for (int k = j + 1; k <= n; ++k) {
        if (i != j && j != k && k != i) {
          ans += in(st[i], st[j], st[k]) == 2;
//          if (in(st[i], st[j], st[k]) == 2) {
//            cout << st[i].x << ' ' << st[i].y << ' ' << st[j].x << ' ' << st[j].y << ' ' << st[k].x << ' ' << st[k].y << endl;
//          }
        }
      }
    }
  }
  cout << ans << endl;
}
  long long add = 0;
  for (int l = 1, r = 1, cr = 0, cnt = 0; l <= n; ++l) {
    r = max(r, l);
    if (l > 1 && 1LL * st[l].x * st[l - 1].y - 1LL * st[l].y * st[l - 1].x == 0 && g(st[l], st[l - 1])) {
      add += 1LL * (r - cr - 1) * (r - cr) / 2;
      cnt--;
      total -= 1LL * cnt * (cnt - 1) / 2;
      continue;
    }
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0 && g(st[l], st[r + 1])) {
      r++;
    }
    int fl = 0;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x > 0) {
      r++;
      fl++;
    }
    cr = r;
    while (r + 1 < l + n && 1LL * st[l].x * st[r + 1].y - 1LL * st[l].y * st[r + 1].x == 0) {
      r++;
    }
    cnt = r - l;
    add += 1LL * (r - cr - 1) * (r - cr) / 2;
    total -= 1LL * cnt * (cnt - 1) / 2;
  }
  total += add;
if (DEBUG) {
  if (0 != max(total, 0LL)) {
    freopen("input.txt", "w", stdout);
    cout << 100 << ' ' << 0 << ' ' << 0 << endl;
    for (int i = 1; i <= n; ++i) {
      cout << st[i].r << ' ' << st[i].w << endl;
    }
    throw;
  }
}
  cout << max(total, 0LL) << endl;
  return 0;
}


#include <algorithm>
#include <fstream>
#include <iostream>
#include <cassert>
#include <iomanip>
#include <functional>
#include <utility>
#include <queue>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <complex>
#include <stack>
#include <array>

#define FOR(i, n) for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define X(A) get<0>(A)
#define Y(A) get<1>(A)
#define Z(A) get<2>(A)

#define mp make_pair
#define mt make_tuple
#define pb push_back

//------------------------------------------------------------------------------

using namespace std;
using lli = long long int;
using llu = long long unsigned;

using pii   = tuple<lli, lli>;
using ppii  = tuple<pii, pii>;
using piii  = tuple<lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;
using vvvii = vector<vvii>;
using pt    = complex<lli>;

//------------------------------------------------------------------------------

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B>
ostream& operator<<(ostream& s, tuple<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B, class C>
ostream& operator<<(ostream& s, tuple<A, B, C> const& a){
  return s << "(" << X(a) << "," << Y(a) << "," << Z(a) << ")";
}

template<class T>
ostream& operator<<(ostream& s, vector<T> const& a){
  FOR(i, a.size()){
    s << a[i];
    if(i != (lli)a.size()-1) s << " ";
  }
  return s;
}

//------------------------------------------------------------------------------

lli gcd(lli a, lli b){ return (a%b==0)?b:gcd(b, a%b); }

pii no(pii const& a){
  pii b = a;
  auto g = gcd(X(b), Y(b));
  X(b) /= g; Y(b) /= g;
  if(Y(b) < 0) { X(b) *= -1; Y(b) *= -1; }
  return b;
}

struct cmp{
  bool operator()(pii const& a, pii const& b) const{
    return X(a) * Y(b) > X(b) * Y(a);
  }
};

int main(int, char**){
  ios::sync_with_stdio(false);
  lli n, c, d; cin >> n >> c >> d;
  map<pii, array<int, 2>, cmp> A;
  lli B[2] = {0, 0};
  FOR(i, n) {
    lli r, w; cin >> r >> w;
    r -= c; w -= d;
    if(w != 0) {
      auto a_ = no(mt(r, w));
      A[a_][w > 0] += 1;
    } else B[r > 0] += 1;
  }
  // ---
  lli R[2] = {0, 0};
  lli L[2] = {0, 0};
  lli r = 0;
  for(auto x : A) FOR(i, 2) R[i] += x.second[i];
  for(auto x : A){
    FOR(i, 2) R[i] -= x.second[i];
    FOR(i, 2) r += x.second[i] * L[1-i] * R[1-i];
    FOR(i, 2) r += x.second[i] * B[i] * L[1-i];
    FOR(i, 2) L[i] += x.second[i];
  }
  cout << r << endl;

  return 0;
}


#include <algorithm>
#include <fstream>
#include <iostream>
#include <cassert>
#include <iomanip>
#include <functional>
#include <utility>
#include <queue>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <complex>
#include <stack>

#define FOR(i, n) for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define X(A) get<0>(A)
#define Y(A) get<1>(A)
#define Z(A) get<2>(A)

#define mp make_pair
#define mt make_tuple
#define pb push_back

//------------------------------------------------------------------------------

using namespace std;
using lli = long long int;
using llu = long long unsigned;

using pii   = tuple<lli, lli>;
using ppii  = tuple<pii, pii>;
using piii  = tuple<lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;
using vvvii = vector<vvii>;
using pt    = complex<lli>;

//------------------------------------------------------------------------------

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B>
ostream& operator<<(ostream& s, tuple<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B, class C>
ostream& operator<<(ostream& s, tuple<A, B, C> const& a){
  return s << "(" << X(a) << "," << Y(a) << "," << Z(a) << ")";
}

template<class T>
ostream& operator<<(ostream& s, vector<T> const& a){
  FOR(i, a.size()){
    s << a[i];
    if(i != (lli)a.size()-1) s << " ";
  }
  return s;
}

//------------------------------------------------------------------------------

pii no(pii const& a){
  pii b = a;
  if(Y(b) < 0) { X(b) *= -1; Y(b) *= -1; }
  return b;
}

int main(int, char**){
  ios::sync_with_stdio(false);
  lli n, c, d; cin >> n >> c >> d;

  vii A;
  lli B[2] = {0, 0};
  FOR(i, n) {
    lli r, w; cin >> r >> w;
    r -= c; w -= d;
    if(w != 0) A.pb(mt(r, w));
    else B[r > 0] += 1;
  }
  sort(A.begin(), A.end(), [&](pii const& a, pii const& b){
      auto a_ = no(a), b_ = no(b);
      return X(a_) * Y(b_) > X(b_) * Y(a_);
    });
  // ---
  lli R[2] = {0, 0};
  lli L[2] = {0, 0};
  lli r = 0;
  for(auto x : A) R[Y(x) > 0] += 1;
  for(auto x : A){
    R[Y(x) > 0] -= 1;
    r += L[Y(x) < 0] * R[Y(x) < 0];

    r += B[Y(x) < 0] * L[Y(x) < 0];
    L[Y(x) > 0] += 1;
  }
  cout << r << endl;

  return 0;
}


#include <algorithm>
#include <fstream>
#include <iostream>
#include <cassert>
#include <iomanip>
#include <functional>
#include <utility>
#include <queue>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <complex>
#include <stack>

#define FOR(i, n) for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define X(A) get<0>(A)
#define Y(A) get<1>(A)
#define Z(A) get<2>(A)

#define mp make_pair
#define mt make_tuple
#define pb push_back

//------------------------------------------------------------------------------

using namespace std;
using lli = long long int;
using llu = long long unsigned;

using pii   = tuple<lli, lli>;
using ppii  = tuple<pii, pii>;
using piii  = tuple<lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;
using vvvii = vector<vvii>;
using pt    = complex<lli>;

//------------------------------------------------------------------------------

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B>
ostream& operator<<(ostream& s, tuple<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B, class C>
ostream& operator<<(ostream& s, tuple<A, B, C> const& a){
  return s << "(" << X(a) << "," << Y(a) << "," << Z(a) << ")";
}

template<class T>
ostream& operator<<(ostream& s, vector<T> const& a){
  FOR(i, a.size()){
    s << a[i];
    if(i != (lli)a.size()-1) s << " ";
  }
  return s;
}

//------------------------------------------------------------------------------

pii no(pii const& a){
  pii b = a;
  if(Y(b) < 0) { X(b) *= -1; Y(b) *= -1; }
  return b;
}

int main(int, char**){
  ios::sync_with_stdio(false);
  lli n, c, d; cin >> n >> c >> d;

  vii A;
  lli B[2] = {0, 0};
  FOR(i, n) {
    lli r, w; cin >> r >> w;
    r -= c; w -= d;
    if(w != 0) A.pb(mt(r, w));
    else B[r>0] += 1;
  }
  sort(A.begin(), A.end(), [&](pii const& a, pii const& b){
      auto a_ = no(a), b_ = no(b);
      return X(a_) * Y(b_) > X(b_) * Y(a_);
    });
  // ---
  lli R[2] = {0, 0};
  lli L[2] = {0, 0};
  lli r = 0;
  for(auto x : A) R[Y(x) > 0] += 1;
  for(auto x : A){
    R[Y(x) > 0] -= 1;
    r += L[Y(x) < 0] * R[Y(x) < 0];
    r += B[Y(x) > 0] * L[Y(x) < 0];
    L[Y(x) > 0] += 1;
  }
  cout << r << endl;

  return 0;
}


#include <algorithm>
#include <fstream>
#include <iostream>
#include <cassert>
#include <iomanip>
#include <functional>
#include <utility>
#include <queue>
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <complex>
#include <stack>
#include <array>

#define FOR(i, n) for(lli i = 0; i < (lli)(n); ++i)
#define FORU(i, j, k) for(lli i = (j); i <= (lli)(k); ++i)
#define FORD(i, j, k) for(lli i = (j); i >= (lli)(k); --i)

#define X(A) get<0>(A)
#define Y(A) get<1>(A)
#define Z(A) get<2>(A)

#define mp make_pair
#define mt make_tuple
#define pb push_back

//------------------------------------------------------------------------------

using namespace std;
using lli = long long int;
using llu = long long unsigned;

using pii   = tuple<lli, lli>;
using ppii  = tuple<pii, pii>;
using piii  = tuple<lli, lli, lli>;
using vi    = vector<lli>;
using vii   = vector<pii>;
using viii  = vector<piii>;
using vvi   = vector<vi>;
using vvii  = vector<vii>;
using vviii = vector<viii>;
using vvvii = vector<vvii>;
using pt    = complex<lli>;

//------------------------------------------------------------------------------

template<class A, class B>
ostream& operator<<(ostream& s, pair<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B>
ostream& operator<<(ostream& s, tuple<A, B> const& a){
  return s << "(" << X(a) << "," << Y(a) << ")";
}

template<class A, class B, class C>
ostream& operator<<(ostream& s, tuple<A, B, C> const& a){
  return s << "(" << X(a) << "," << Y(a) << "," << Z(a) << ")";
}

template<class T>
ostream& operator<<(ostream& s, vector<T> const& a){
  FOR(i, a.size()){
    s << a[i];
    if(i != (lli)a.size()-1) s << " ";
  }
  return s;
}

//------------------------------------------------------------------------------

lli gcd(lli a, lli b){ return (a%b==0)?b:gcd(b, a%b); }

pii no(pii const& a){
  pii b = a;
  auto g = gcd(X(b), Y(b));
  X(b) /= g; Y(b) /= g;
  if(Y(b) < 0) { X(b) *= -1; Y(b) *= -1; }
  return b;
}

struct cmp{
  bool operator()(pii const& a, pii const& b) const{
    return X(a) * Y(b) > X(b) * Y(a);
  }
};

int main(int, char**){
  ios::sync_with_stdio(false);
  lli n, c, d; cin >> n >> c >> d;
  map<pii, array<int, 2>, cmp> A;
  lli B[2] = {0, 0};
  FOR(i, n) {
    lli r, w; cin >> r >> w;
    r -= c; w -= d;
    if(w != 0) {
      auto a_ = no(mt(r, w));
      A[a_][w > 0] += 1;
    } else B[r > 0] += 1;
  }
  // ---
  lli R[2] = {0, 0};
  lli L[2] = {0, 0};
  lli r = 0;
  for(auto x : A) FOR(i, 2) R[i] += x.second[i];
  for(auto x : A){
    FOR(i, 2) R[i] -= x.second[i];
    FOR(i, 2) r += L[i] * R[i];
    FOR(i, 2) r += x.second[i] * B[i] * L[1-i];
    FOR(i, 2) L[i] += x.second[i];
  }
  cout << r << endl;

  return 0;
}


#include<cstdio>
#include<algorithm>
const double esp=1e-9;
inline double sqrt(const double& x){
    static double l=0,r=x,m;
    while(l+esp<r){
        m=(l+r)/2;
        if(m*m<x)l=m;
        else r=m;
    }
    return l;
}
struct point{
    int x,y;
};
inline bool cmp(const point &a,const point &b){
    const bool aflg=a.y>=0,bflg=b.y>=0;
        if(aflg^bflg)return aflg<bflg;
    if(aflg)return a.x*sqrt((long long)b.x*b.x+(long long)b.y*b.y)>b.x*sqrt((long long)a.x*a.x+(long long)a.y*b.y);
    return  a.x*sqrt((long long)b.x*b.x+(long long)b.y*b.y)<b.x*sqrt((long long)a.x*a.x+(long long)a.y*b.y);
}
char ibuf[7605000],*ip=ibuf;
inline void readi(int &n){
    while(*ip<49||*ip>57)ip++;n=*ip++-48;
    while(48<=*ip&&*ip<=57)n=(n<<1)+(n<<3)+*ip++-48;
}
inline void readp(const int &n,const int &c,const int &d,point *p){
    int x,y,i=0;
    while(i<n){
        readi(x);readi(y);
        x-=c;y-=d;
        p[i++]=(point){x,y};
    }
    std::sort(p,p+n,cmp);
}
int main(){
    fread(ibuf,7605000,1,stdin);
    int c,d;readi(c);const int n=c;
    readi(c);readi(d);
    point p[n];
    readp(n,c,d,p);
    d=0;while(d<n&&p[d].y<0)d++;
    if(d==n){putchar(48);return 0;}
    int nm=0;const int nd=d;
    int s[n],stp[nd];
    for(c=0;c<n;c++){
        while(d<n&&(long long)p[c].x*p[d].y-(long long)p[d].x*p[c].y>0){
            nm++;d++;
        }
        s[c]=nm;
        if(c<nd)stp[c]=d;
    }
    long long ans=0,pre=0;
    c=-1;d=0;
    while(++c<nd){
        while(d<stp[c])pre+=s[d++];
        ans+=pre-(long long)(d-c)*s[c];
        if(d>c)pre-=s[c];
    }
    printf("%I64d",ans);
    return 0;
}


#include<cstdio>
#include<algorithm>
struct point{
	int x,y;
};
inline bool cmp(const point &a,const point &b){
	bool aflg=a.x<=0,bflg=b.x<=0;
    if(aflg^bflg)return aflg<bflg;
    if(!a.x){
        if(a.y>0)return true;
        return false;
    }
    if(!b.x){
        if(b.y>0)return false;
        return true;
    }
	return (long long)a.y*b.x<(long long)a.x*b.y;
}
char ibuf[7605000],*ip=ibuf;
inline void readi(int &n){
	while(*ip<49||*ip>57)ip++;n=*ip++-48;
	while(48<=*ip&&*ip<=57)n=(n<<1)+(n<<3)+*ip++-48;
}
inline void readp(const int &n,const int c,const int d,point *p){
	int x,y,i=0;
	while(i<n){
		readi(x);readi(y);
		x-=c;y-=d;
		p[i++]=(point){x,y};
	}
	std::sort(p,p+n,cmp);
}
point p[345679];
int s[345678],stp[345678],us[345678];
int main(){
	fread(ibuf,7605000,1,stdin);
	int c,d;readi(c);const int n=c;
	readi(c);readi(d);
	readp(n,c,d,p);
	d=0;while(d<n&&p[d].x>0)d++;
	if(d==n){putchar(48);return 0;}
	int nm;const int nd=d;
	for(c=0;c<n;c++){
		while(d<n&&(long long)p[c].x*p[d].y-(long long)p[d].x*p[c].y>0)d++;
		s[c]=d-nd;
		nm=d;while(nm<n&&(long long)p[c].x*p[nm].y-(long long)p[nm].x*p[c].y==0)nm++;
		us[c]=nm-nd;
		if(c<nd)stp[c]=d;
	}
	long long ans=0,pre=0;
	c=-1;d=0;
	while(++c<nd){
		while(d<stp[c])pre+=s[d++];pre-=s[c];
		nm=1;while(c+1<nd&&(long long)p[c].x*p[c+1].y-(long long)p[c].y*p[c+1].x==0)nm++,pre-=s[++c];
		ans+=(pre-(long long)(d-c-1)*us[c])*nm;
	}
	printf("%I64d",ans);
	return 0;
}


#include <algorithm>
#include <iostream>
#define point pair<long long, long long>
#define x first
#define y second
using namespace std;
const int MAX = 1000000;
point p[MAX];
long long cross(point a, point b) { return a.x * b.y - a.y * b.x; }
bool ss(point a, point b) {
  if (a > make_pair(0LL, 0LL) && b > make_pair(0LL, 0LL)) return true;
  if (a < make_pair(0LL, 0LL) && b < make_pair(0LL, 0LL)) return true;
  return false;
}
bool cmp(point a, point b) {
  if (!ss(a, b)) return (a > make_pair(0LL, 0LL) && b < make_pair(0LL, 0LL));
  if (cross(a, b) == 0) return (a < b);
  return (cross(a, b) > 0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, c, d;
  cin >> n >> c >> d;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    a -= c;
    b -= d;
    p[i] = make_pair(a, b);
  }
  sort(p, p + n, cmp);
  for (int i = n; i < 2 * n; i++) p[i] = p[i - n];
  long long ans = 1LL * n * (n - 1) * (n - 2) / 6;
  int ptr = 0;
  for (int i = 0; i < n; i++) {
    int j = i + 1;
    while (j < n && ss(p[i], p[j]) && cross(p[i], p[j]) == 0) j++;
    ptr = max(ptr, j);
    int len3 = 0;
    while (ptr < i + n && cross(p[i], p[ptr]) >= 0) {
      if (cross(p[i], p[ptr]) == 0) len3++;
      ptr++;
    }
    int len1 = ptr - j;
    int len2 = j - i;
    if (p[i] < make_pair(0LL, 0LL)) {
      ans += 1LL * len2 * (len2 - 1) / 2 * len3;
      ans += 1LL * len3 * (len3 - 1) / 2 * len2;
    }
    ans -= 1LL * len1 * (len1 - 1) / 2 * len2;
    ans -= 1LL * len2 * (len2 - 1) / 2 * len1;
    ans -= 1LL * len2 * (len2 - 1) * (len2 - 2) / 6;
    i = j - 1;
  }
  cout << ans << "\n";
  return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
#define y1 ysghysgsygsh
using namespace std;
const int N=350000;
struct P{
	int x,y;
	P(){}
	P(int _x,int _y){
		x=_x; y=_y;
	}
	bool be()const{
		return x?x>0:y>0;
	}
	P operator +(const P &a)const{
		return P(x+a.x,y+a.y);
	}
	P operator -(const P &a)const{
		return P(x-a.x,y-a.y);
	}
	ll operator *(const P &a)const{
		return 1ll*x*a.y-1ll*y*a.x;
	}
	bool operator ==(const P &a)const{
		return 1ll*x*a.y==1ll*y*a.x&&be()==a.be();
	}
}p[N*2];
ll ans,SSS[N*2];
int n,PX,PY;
int S[N*2],SS[N*2];
bool cmp(P x,P y){
	return x.be()^y.be()?x.be():x*y>0;
}
int main(){
	scanf("%d%d%d",&n,&PX,&PY);
	For(i,1,n){
		scanf("%d%d",&p[i].x,&p[i].y);
		p[i].x-=PX; p[i].y-=PY;
		//cout<<p[i].x<<
	}
	sort(p+1,p+n+1,cmp);
	int top=1; S[1]=1;
	For(i,2,n){
		if (!(p[i]==p[i-1]))
			p[++top]=p[i];
		++S[top];
	}
	n=top;
	For(i,1,n){
		//printf("%d %d %d\n",p[i].x,p[i].y,S[i]);
		p[i+n]=p[i]; S[i+n]=S[i];
	}
	For(i,1,n*2){
		SS[i]=SS[i-1]+S[i];
		SSS[i]=SSS[i-1]+1ll*S[i]*S[i];
	}
	For(i,1,n) ans+=1ll*S[i]*(1ll*SS[i-1]*SS[i-1]-SSS[i-1])/2;
	int p1=1;
	//printf("%c %c %c\n",p[1].be()?'Y':'N',p[2].be()?'Y':'N',cmp(p[1],p[2])?'Y':'N');
	//cout<<p[1]*p[2]<<' '<<ans<<endl;
	For(i,1,n){
		p1=max(p1,i);
		for (;p1+1!=i+n&&p[i]*p[p1+1]>=0;++p1);
		ans-=1ll*S[i]*(1ll*(SS[p1]-SS[i])*(SS[p1]-SS[i])-(SSS[p1]-SSS[i]))/2;

		//cout<<p1<<' '<<ans<<endl;
	}
	printf("%lld\n",ans);
}//hellobig_tq//hello


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-11;
int r[N], w[N];
vector<double> positive, negative;
bool comp(double a, double b)
{
    if(abs(a - b) > eps && a < b)
        return true;
    else
        return false;
}
map<int, int> compress;
int bit[N];
void update(int v, int val)
{
    while(v < N)
    {
        bit[v] += val;
        v += (v & (-v));
    }
}
int query(int v)
{
    int ret = 0;
    while(v)
    {
        ret += bit[v];
        v -= (v & (-v));
    }
    return ret;
}
vector<pair<double, int>> all;
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
    }
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            positive.pb(((double)r[i]) / w[i]);
        }
        else if(w[i] < 0)
        {
            negative.pb(((double)r[i]) / w[i]);
        }
    }
    sort(positive.begin(), positive.end(), comp);
    sort(negative.begin(), negative.end(), comp);

    ll first = 0, second = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
            all.pb(mp(((double)r[i]) / w[i], w[i]));
    }
    sort(all.begin(), all.end());
    memset(bit, 0, sizeof bit);
    for(int i = 0; i < all.size(); ++i)
    {
        int ww = compress[all[i].S];
        first += query(ww - 1);
        second += i - query(ww);
        update(ww, 1);
    }
    all.clear();
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] < 0)
            all.pb(mp(((double)r[i]) / w[i], w[i]));
    }
    sort(all.begin(), all.end());
    memset(bit, 0, sizeof bit);
    for(int i = 0; i < all.size(); ++i)
    {
        int ww = compress[all[i].S];
        first += query(ww - 1);
        second += i - query(ww);
        update(ww, 1);
    }
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i], comp) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i], comp) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            ans += (negative.end() - upper_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i], comp)) * (lower_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i], comp) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += (positive.end() - upper_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i], comp)) * (lower_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i], comp) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] > 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-18;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = (((double)r[i]) / (double)w[i]);
    }
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        cerr<<x<<" "<<p[i]<<endl;
        assert(x == p[i]);
        if(w[i] > 0)
        {
            positive.pb(x);
        }
        else if(w[i] < 0)
        {
            negative.pb(x);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        if(w[i] > 0)
        {
            assert(abs(x - p[i]) < eps);
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), x))) * (lower_bound(negative.begin(), negative.end(), x) - negative.begin());
        }
        else if(w[i] < 0)
        {
            assert(abs(x - p[i]) < eps);
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), x))) * (lower_bound(positive.begin(), positive.end(), x) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-11;
int r[N], w[N];
vector<double> positive, negative;
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
    }
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            positive.pb(((double)r[i]) / w[i]);
        }
        else if(w[i] < 0)
        {
            negative.pb(((double)r[i]) / w[i]);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i]))) * (lower_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i]) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i]))) * (lower_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i]) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-11;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = (((double)r[i]) / w[i]);
    }
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / w[i]);
        assert(x == p[i]);
        if(w[i] > 0)
        {
            positive.pb(x);
        }
        else if(w[i] < 0)
        {
            negative.pb(x);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {

        if(w[i] > 0)
        {
            double x = (((double)r[i]) / w[i]);
            assert(x == p[i]);
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), x))) * (lower_bound(negative.begin(), negative.end(), x) - negative.begin());
        }
        else if(w[i] < 0)
        {
            double x = (((double)r[i]) / w[i]);
            assert(x == p[i]);
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), x))) * (lower_bound(positive.begin(), positive.end(), x) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-18;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = (((double)r[i]) / (double)w[i]);
    }
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        if(w[i] > 0)
        {
            positive.pb(x);
        }
        else if(w[i] < 0)
        {
            negative.pb(x);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        assert(abs(x - p[i]) < eps);
        if(w[i] > 0)
        {
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), p[i]))) * (lower_bound(negative.begin(), negative.end(), p[i]) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), p[i]))) * (lower_bound(positive.begin(), positive.end(), p[i]) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-11;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = ((double)r[i]) / w[i];
    }
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            positive.pb(p[i]);
        }
        else if(w[i] < 0)
        {
            negative.pb(p[i]);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), p[i]))) * (lower_bound(negative.begin(), negative.end(), p[i]) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), p[i]))) * (lower_bound(positive.begin(), positive.end(), p[i]) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-11;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = ((double)r[i]) / w[i];
    }
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            positive.pb(p[i]);
        }
        else if(w[i] < 0)
        {
            negative.pb(p[i]);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            ans += ((negative.end() - upper_bound(negative.begin(), negative.end(), p[i]))) * (lower_bound(negative.begin(), negative.end(), p[i]) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += ((positive.end() - upper_bound(positive.begin(), positive.end(), p[i]))) * (lower_bound(positive.begin(), positive.end(), p[i]) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
typedef unsigned long long ul;
int r[N], w[N];
vector<double> positive, negative;
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
    }
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            positive.pb(((double)r[i]) / w[i]);
        }
        else
        {
            negative.pb(((double)r[i]) / w[i]);
        }
    }
    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());
    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            ans += (negative.end() - upper_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i])) * (lower_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i]) - negative.begin());
        }
        else
        {
            ans += (positive.end() - upper_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i])) * (lower_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i]) - positive.begin());
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-11;
int r[N], w[N];
vector<double> positive, negative;
bool comp(double a, double b)
{
    if(abs(a - b) > eps && a < b)
        return true;
    else
        return false;
}
map<int, int> compress;
int bit[N];
void update(int v, int val)
{
    while(v < N)
    {
        bit[v] += val;
        v += (v & (-v));
    }
}
int query(int v)
{
    int ret = 0;
    while(v)
    {
        ret += bit[v];
        v -= (v & (-v));
    }
    return ret;
}
vector<pair<double, int>> all;
vi compression;
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
    }
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            positive.pb(((double)r[i]) / w[i]);
        }
        else if(w[i] < 0)
        {
            negative.pb(((double)r[i]) / w[i]);
        }
        compression.pb(w[i]);
    }
    sort(compression.begin(), compression.end());
    for(int i = 0, ct = 1; i < compression.size(); ++i)
    {
        if(i == 0 || compression[i] > compression[i - 1])
            compress[compression[i]] = ct++;
    }
    sort(positive.begin(), positive.end(), comp);
    sort(negative.begin(), negative.end(), comp);

    ll first = 0, second = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
            all.pb(mp(((double)r[i]) / w[i], w[i]));
    }
    sort(all.begin(), all.end());
    memset(bit, 0, sizeof bit);
    for(int i = 0; i < all.size(); ++i)
    {
        int ww = compress[all[i].S];
        first += query(ww - 1);
        second += i - query(ww);
        update(ww, 1);
    }
    all.clear();
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] < 0)
            all.pb(mp(((double)r[i]) / w[i], w[i]));
    }
    sort(all.begin(), all.end());
    memset(bit, 0, sizeof bit);
    for(int i = 0; i < all.size(); ++i)
    {
        int ww = compress[all[i].S];
        first += query(ww - 1);
        second += i - query(ww);
        update(ww, 1);
    }
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i], comp) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i], comp) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        if(w[i] > 0)
        {
            ans += (negative.end() - upper_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i], comp)) * (lower_bound(negative.begin(), negative.end(), ((double)r[i]) / w[i], comp) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += (positive.end() - upper_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i], comp)) * (lower_bound(positive.begin(), positive.end(), ((double)r[i]) / w[i], comp) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] > 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-18;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = (((double)r[i]) / (double)w[i]);
    }
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        if(w[i] > 0)
        {
            positive.pb(x);
        }
        else if(w[i] < 0)
        {
            negative.pb(x);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {

        if(w[i] > 0)
        {
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), p[i]))) * (lower_bound(negative.begin(), negative.end(), p[i]) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), p[i]))) * (lower_bound(positive.begin(), positive.end(), p[i]) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-18;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = (((double)r[i]) / (double)w[i]);
    }
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        if(w[i] > 0)
        {
            positive.pb(x);
        }
        else if(w[i] < 0)
        {
            negative.pb(x);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        if(w[i])
        {
            if(abs(x - p[i]) >= eps)
            {
                cerr<<i<<" "<<x<<" "<<p[i]<<" "<<(x - p[i])<<endl;
            }
        }
        if(w[i] > 0)
        {
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), p[i]))) * (lower_bound(negative.begin(), negative.end(), p[i]) - negative.begin());
        }
        else if(w[i] < 0)
        {
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), p[i]))) * (lower_bound(positive.begin(), positive.end(), p[i]) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define debug(X) cerr << " --> " << #X << " = " << X << endl
#define mod 1000000007LL
#define inf 1123456789123456789LL
#define endl "\n"
typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; typedef vector<pii> vpii;
const int N = 512345, lgN = 20, rootN = 1123;
const double eps = 1e-18;
int r[N], w[N];
vector<double> positive, negative;
double p[N];
int main()
{
    int n, c, d;
    cin>>n>>c>>d;
    for(int i = 1; i <= n; ++i)
    {
        cin>>r[i]>>w[i];
        r[i] -= c, w[i] -= d;
        p[i] = (((double)r[i]) / (double)w[i]);
    }
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        assert(x == p[i]);
        if(w[i] > 0)
        {
            positive.pb(x);
        }
        else if(w[i] < 0)
        {
            negative.pb(x);
        }
    }

    sort(positive.begin(), positive.end());
    sort(negative.begin(), negative.end());

    ll first = 0, second = 0;
    for(int i = 0; i < positive.size(); ++i)
    {
        first += (lower_bound(negative.begin(), negative.end(), positive[i]) - negative.begin());
    }
    for(int i = 0; i < negative.size(); ++i)
    {
        second += (lower_bound(positive.begin(), positive.end(), negative[i]) - positive.begin());
    }

    ll ans = 0;
    for(int i = 1; i <= n; ++i)
    {
        double x = (((double)r[i]) / (double)w[i]);
        if(w[i] > 0)
        {
            assert(abs(x - p[i]) < eps);
            ans += ((long long)(negative.end() - upper_bound(negative.begin(), negative.end(), x))) * (lower_bound(negative.begin(), negative.end(), x) - negative.begin());
        }
        else if(w[i] < 0)
        {
            assert(abs(x - p[i]) < eps);
            ans += ((long long)(positive.end() - upper_bound(positive.begin(), positive.end(), x))) * (lower_bound(positive.begin(), positive.end(), x) - positive.begin());
        }
        else if(w[i] == 0)
        {
            if(r[i] < 0)
                ans += first;
            else
                ans += second;
        }
    }
    printf("%lld\n", ans);
    return 0;
}