# I. 682.
# Rajtik Sándor Barnabás 10. o.
# Budapest, Budapesti Fazekas M. Gyak. Ált. Isk. és Gimn.

N = int(input())
S = list(map(int, input().split()))

colors = [-1]*N
while -1 in colors:
    next_color = 1
    author = S[colors.index(-1)]
    banned_colors = set()
    for i in range(N):
        if S[i] == author:
            if i>0:   banned_colors.add(colors[i-1])
            if i<N-1: banned_colors.add(colors[i+1])
    for c in range(1,N+1):
        if c not in list(banned_colors):
            next_color = c
            break
    for i in range(N):
        if S[i] == author:
            colors[i] = next_color

num = len(list(set(colors)))
print(num)
print(" ".join([str(colors.count(i)) for i in range(1,num+1)]))
print(" ".join([str(c) for c in colors]))
