import sequtils,strutils,strscans,algorithm,math,future,macros import sets,tables,hashes template get*():string = stdin.readLine() #.strip() proc coundDuplicate[T](keys:openArray[T]): seq[tuple[key:T,val:int]] = var ct = initCountTable[T](nextPowerOfTwo(keys.len * 3 div 2 + 4)) for k in items(keys): ct[k] = 1 + (if k in ct : ct[k] else: 0) return toSeq(ct.pairs) template fgets(f:File,buf:untyped,size:int):void = proc c_fgets(c: cstring, n: int, file: File): void {.importc: "fgets", header: "", tags: [ReadIOEffect].} var buf: array[size, char] c_fgets(buf,sizeof(buf),f) let N = get().parseInt stdin.fgets(buf,100000 * 2 + 2) echo buf.coundDuplicate() .filterIt('0' <= it.key and it.key <= '9') .sorted((x,y) => (if x.val != y.val : x.val - y.val else: x.key.ord - y.key.ord),Descending)[0].key