#include <bits/stdc++.h>
using namespace std;
const int N = 100009;
double R, D, x, y, r;
int n, ans;
int main() {
  cin >> R >> D >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> x >> y >> r;
    double dis = sqrt(x * x + y * y);
    if (dis >= R - D + r && dis + r <= R) ++ans;
  }
  cout << ans;
  return 0;
}
