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.filterIt('0' <= it and it <= '9').mapIt(it.ord - '0'.ord).coundDuplicate() .sorted((x,y) => (if x[1] != y[1] : x[1] - y[1] else: x[0] - y[0]),Descending)[0].key