import times, strutils, sequtils, math, algorithm, tables, sets, lists, intsets import critbits, future, strformat, deques template `max=`(x,y) = x = max(x,y) template `min=`(x,y) = x = min(x,y) template `mod=`(x,y) = x = x mod y template scan2 = (scan(), scan()) template scan3 = (scan(), scan()) let read* = iterator: string {.closure.} = while true: (for s in stdin.readLine.split: yield s) proc scan(): int = read().parseInt proc scanf(): float = read().parseFloat proc toInt(c:char): int = return int(c) - int('0') proc solve():int= var n = scan() mx = 10^6 v = newseqwith(mx+1,false) dpt = newseqwith(mx+1,0) add1 = false for i in 0..0: var (p,cost) = q.popFirst() if dpt[p] > cost:continue dpt[p] = cost var m = 2 while p*m <= mx: if v[p*m]: q.addLast((p*m,cost+1)) break m+=1 #bfs(1) dpt[1]=1 for i in 1..mx: var m = 2 if v[i]: while i*m<=mx: if v[i*m]: dpt[i*m].max=dpt[i]+1 m+=1 #echo dpt[0..12] if add1: return dpt.max()-1 else: return dpt.max() echo solve()