#================================== # #================================== import sequtils import strutils import bitops import math import deques proc BFS(graph:seq[seq[int]],first:int):seq[int]= var isSeen = newSeq[bool](graph.len) var queue = newSeq[int]().toDeque var distance = newSeqWith(graph.len,-1) distance[first] = 1 queue.addFirst(first) while queue.len != 0: var a = queue.popFirst() isSeen[a] = true for i in graph[a]: if not isSeen[i]: queue.addFirst(i) distance[i] = distance[a] + 1 return distance proc f(i:int):int = var s = i.toBin(14) result = 0 for value in s: if value == '1': result += 1 var n = stdin.readLine.parseInt var graph = newSeqWith(n,newSeq[int]()) for i in 1..n: if 0