import sys mask = 16777216-1 def ng(n:int) -> int: n ^= (n << 6) & mask n ^= (n >> 5) & mask n ^= (n << 11) & mask return n ranges = dict() for seed in map(int,sys.stdin.read().strip().split('\n')): visited = set() pseed = seed % 10 key = 0 for i in range(2000): nextSeed = ng(seed) nseed = nextSeed %10 change = 9 + nseed - pseed key = (key * 19 + change) % 130321 if i>2: if key not in visited: if key not in ranges: ranges[key] = 0 ranges[key] += nseed visited.add(key) seed = nextSeed pseed = nseed print(max(ranges.values()))