output_description: Output line contains one integer - the number of connected subsets - for each
  input line.
input_description: Each data set is defined as one line with two integers as follows:
  
  _Line 1_ : Number of nodes _V_ and the distance _d_.
  
  Input includes several data sets (i.e., several lines). The number of dat sets
  is less than or equal to 50.
attempt: while 1:
      try:
          v, d = map(int, input().split())
          f = [0] * (v + 1)
          f[0], f[1] = 1, 2
          for i in range(2, v + 1):
              f[i] = f[i - 1] + f[i - 2]
          f.sort()
          c = 1
          for i in range(2, v + 1):
              if f[i] - f[i - 1] >= d:
                  c += 1
          print(c)
      except:
          break
  
problem_description: H: Fibonacci Sets
  
  Fibonacci number _f_(_i_) appear in a variety of puzzles in nature and math,
  including packing problems, family trees or Pythagorean triangles. They obey
  the rule _f_(_i_) = _f_(_i_ \- 1) + _f_(_i_ \- 2), where we set _f_(0) = 1 =
  _f_(-1).
  
  Let _V_ and _d_ be two certain positive integers and be _N_ ≡ 1001 a constant.
  Consider a set of _V_ nodes, each node _i_ having a Fibonacci label _F_[_i_] =
  (_f_(_i_) mod N) assigned for _i_ = 1,..., _V_ ≤ N. If |_F_(_i_) - _F_(_j_)| <
  _d_ , then the nodes _i_ and _j_ are connected.
  
  Given _V_ and _d_ , how many connected subsets of nodes will you obtain?
  
  ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE1_fibonaccisets)
  
  Figure 1: There are 4 connected subsets for _V_ = 20 and _d_ = 100.
samples: [{"input": "5\n    50 1\n    13 13", "output": "50\n    8"}]