from collections import deque N = int(input()) A = list(map(int, input().split())) que = deque([(0, 0, 0, "")]) # (w, b, i, s) visited = set() visited.add((0, 0, 0)) # (w, b, i) results = [] # N個割り当てたものを保存 while que: w, b, i, s = que.popleft() if i == N: results.append((w, b, s)) continue a = A[i] # 黒に割り当て if (w & a) == 0: w2, b2, i2, s2 = w, b | a, i + 1, s + "B" key = (w2, b2, i2) if key not in visited: visited.add(key) que.append((w2, b2, i2, s2)) # 白に割り当て if (b & a) == 0: w2, b2, i2, s2 = w | a, b, i + 1, s + "W" key = (w2, b2, i2) if key not in visited: visited.add(key) que.append((w2, b2, i2, s2)) # N個割り当てたものの中で最大値 m = 0 ans = "" for w, b, s in results: if w * b > m: m = w * b ans = s print(m) print(ans)