# after listening explanation
n = gets.to_i
x = gets.chomp.chars
mod = 998244353
max_n = 200010
exp = []
f = Array.new(max_n*2, 0)
exp[0] = 1
[*1..n].each {|i| exp[i] = 2*exp[i-1]%mod }
k = 1
while k<=n
  if n%k == 0
    l = n/k
    flag = true
    [*0...n].each {|i|
      break if !flag
      f[l] = (f[l]+(i<l ? exp[l-i-1] : 1))%mod if x[i]=='1' && (i<l || x[i-l]=='1')
      flag = false if i>=l && x[i]==x[i-l]
    }
    f[l] = (f[l]+1)%mod if flag
  end
  k+=2
end
ans = 0
[*1..n].each{|i|
  next unless n%i==0 && n/i%2==1 && f[i]
  ans = (ans+2*f[i]*i)%mod
  [*(i*2)..n].each{|j| f[j] = (f[j]+mod-f[i])%mod }
}
p ans