import sequtils,strutils,algorithm,math import tables,intsets proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: var k = getchar_unlocked() if k < '0' : break else: result = 10 * result + k.ord - '0'.ord proc toCountSeq[T](x:seq[T]) : seq[tuple[k:T,v:int]] = toSeq(x.toCountTable().pairs) let n = scan() let x = scan() var A = initTable[int,int]() # var A = newSeq[int](n) for _ in 0..