#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-7;
int main() {
  int ans = 0;
  long double D, d;
  cin >> D >> d;
  d = D - d;
  int n;
  cin >> n;
  long double x, y, ri, RI;
  for (int i = 0; i < n; i++) {
    cin >> x >> y >> ri;
    RI = sqrt(x * x + y * y);
    if ((RI < D || abs(RI - D) < eps) && (RI > d || abs(RI - d) < eps) &&
        (RI - d > ri || abs(RI - d - ri) < eps) &&
        (D - RI > ri || abs(D - RI - ri) < eps)) {
      ans++;
    }
  }
  cout << ans;
  return 0;
}
