from collections import deque N = int(input()) A = input() M = 998244353 # 次を0に / 前を1に # 01101; 00101, 00001, 00000 # 00011, 00111, 11111 # 01100, 00100 # 11101, 11100 # 01111 s : set[str] = set() find = deque([A]) while find: h = find.popleft() if h in find: continue s.add(h) for i in range(N-1): if h[i] == '0' and h[i+1] == '1': l = h[:i] r = h[i+2:] p = l + '00' + r if p not in s: find.append(p) p = l + '11' + r if p not in s: find.append(p) print(len(s) % M)