def main():
    n = int(input())
    flag = True
    for i in range(n):
        x = input()
        if flag:
            x = bin(int(x,16))[2:]
            if len(x) < n:
                x = '0'*(n-len(x))+x
            if i == 0:
                req = x[0]
                if x.count(req) != len(x):
                    flag = False
            else:
                if x[0] != req:
                    flag = False
                if x.count(req) != len(x):
                    flag = False

    if not flag:
        print(1)
        return

    print(n)

main()
