MOD = 998244353 N = int(input()) S = list(input()) ans = 0 f = 0 for s in S: if f == 0: if s == "1": f = 1 cnt = 1 ans = 1 elif f == 1: if s == "0": cnt += 1 else: ans *= (cnt + 1) ans %= MOD cnt = 1 print(ans)