import sequtils,algorithm template `max=`*(x,y) = x = max(x,y) template `min=`*(x,y) = x = min(x,y) proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord let n = scan() let X = newSeqWith(n,scan()) let xMax = X.max() var dp = newSeqWith(xMax+1,0) for x in X: dp[x] = 1 for i in 1..xMax: if dp[i] == 0 : continue for j in countup(2*i,xMax,i): if dp[j] == 0 : continue dp[j] .max= dp[i] + 1 echo dp.max()