#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pi (3.141592653589)
#define mod 1000000007
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);


bool isPrime(int n){
if(n==1) return false;
if(n==2) return true;
for(int i=2;i*i<=n;i++){
if(n%i==0)return false;
}
return true;
}

int32_t main(){
fast


// Fuck Ratings, I'm in Love with Experience.
// Once a Charas, Always a CHARAS.

int r,x,y;
cin>>r>>x>>y;
double d;
d=sqrt(x*x+y*y);
if(d==r) cout<<"1";
else if(d<=2*r) cout<<"2";
else{
    cout<<ceil(d/r);
}
return 0;
}

#include <bits/stdc++.h>
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

namespace IO {
  char buf[1000000], *p1 = buf, *p2 = buf;
  inline char gc() {
    if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
    return p1 == p2 ? EOF : *(p1++);
  }
  template <class T> inline void read(T &n) {
    n = 0; RI ch = gc(), f;
    while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
    f = (ch == '-' ? ch = gc(), -1 : 1);
    while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
    n *= f;
  }
  char Of[105], *O1 = Of, *O2 = Of;
  template <class T> inline void print(T n, char ch = '\n') {
    if (n < 0) putchar('-'), n = -n;
    if (n == 0) putchar('0');
    while (n) *(O1++) = (n % 10) ^ 48, n /= 10;
    while (O1 != O2) putchar(*(--O1));
    putchar(ch);
  }
}

using IO :: read;
using IO :: print;

int const MAXN = 2e5 + 5;
int fa[MAXN], sz[MAXN], a[MAXN];
map <int, int> mp[MAXN];

int Find(int x) { return x == fa[x] ? x : fa[x] = Find(fa[x]); }

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int n, m; read(n), read(m);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  for (RI i = 1; i <= n; ++i)
    fa[i] = i, sz[i] = 1, mp[i][a[i]] = 1;
  while (m--) {
    int op, x, y; read(op), read(x), read(y);
    if (op == 1) {
      int fx = Find(x), fy = Find(y);
      if (fx == fy) continue;
      if (sz[fx] < sz[fy])
        swap(fx, fy);
      for (auto v : mp[fy])
        mp[fx][v.first] += v.second;
      sz[fx] += sz[fy];
      fa[fy] = fx;
    }
    else {
      int fx = Find(x);
      if (mp[fx].find(y) == mp[fx].end())
        puts("0");
      else
        printf("%d\n", mp[fx][y]);
    }
  }

  return 0;
}