import sequtils,math,times template stopwatch(body) = (let t1 = cpuTime();body;stderr.writeLine "TIME:",(cpuTime() - t1) * 1000,"ms") template times*(n:int,body) = (for _ in 0.." ,discardable.} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': return result = 10 * result + k.ord - '0'.ord #[ template useUnionFind() = # 同一集合の判定/マージ が 実質 O(1) type UnionFind[T] = ref object parent : seq[T] proc newUnionFind[T](size:int) : UnionFind[T] = new(result) result.parent = newSeqUninitialized[T](size) for i in 0.int32..= n div 2 and not isNotPrimes[p]: quit "1",0 stopwatch: var ans = n div 2 - 1 for i in countup(n div 2 + 1,n): if isNotPrimes[i] : ans += 1 echo ans