from functools import reduce

n = int(input())
seals = [tuple(map(float, input().split(','))) for _ in range(n)]

overlapable = [set(i for i, (x2, y2) in enumerate(seals) if (x2 - x1) ** 2 + (y2 - y1) ** 2 <= 4)
               for (x1, y1) in seals]

print(max(len(reduce(lambda cur, sid: cur & overlapable[sid], oll, oll.copy())) for oll in overlapable))