#include <bits/stdc++.h>
int main() {
  double x, y;
  scanf("%lf %lf", &x, &y);
  int m;
  scanf("%d", &m);
  double x1, y1;
  int c;
  int sum = 0;
  while (m--) {
    scanf("%lf %lf %d", &x1, &y1, &c);
    if (sqrt(x1 * x1 + y1 * y1) + c <= x) {
      if (sqrt(x1 * x1 + y1 * y1) >= c &&
          sqrt(x1 * x1 + y1 * y1) - c >= x - y) {
        sum++;
      } else if (sqrt(x1 * x1 + y1 * y1) < c) {
        if (x - y == 0) sum++;
      }
    }
  }
  printf("%d", sum);
}
