import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd n = int(input()) s = input().rstrip() dp = [0]*(n+1) dp[0] = 1 last = -1 for i in range(1,n+1): if s[i-1] == "1": dp[i] += dp[i-1] last = i elif last != -1: dp[i] += dp[last-1] dp[i] += dp[i-1] dp[i] %= 998244353 print((dp[-1]-dp[-2])%998244353)