fork download
  1. a=r,=0,
  2. exec'r=len(a)-a[a[r]];a+=r,;'*input()
  3. print r
Success #stdin #stdout 0.59s 9080KB
stdin
10000
stdout
6823