#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}


using namespace std;
#include <bitset>

// if odd:  k >>= 1; (MSB = 0)
// if even: k >>= 1 and MSB = 1;

/*
 * eg. 0 -> 1000...0 -> 1100...0 -> ... -> 1111...1 -> 0111...1 -> ... -> 0000...1 -> 0
 *
*/

struct Prime {
  int max_check;
  int max_prime;
  int prime_number;
  vector<int> primes;
  map<int, int> prime_id;
  Prime() {};
  Prime(int m) {
    initialize(m);
  };
  void initialize(int m) {
    sieve(m);
    prime_number = (int)primes.size();
    max_check = m;
  }

  void sieve(int m) {
    max_prime = 2;
    deque<bool> is_prime(m+1, true);
    is_prime[0] = is_prime[1] = false;
    int i;
    for (i = 2; i <= m; ++i) {
      if (!is_prime[i]) {
        continue;
      }
      if (i * i > m) {
        break;
      }
      for (int j = i*2; j <= m; j += i) {
        is_prime[j] = false;
      }
      prime_id[i] = (int)primes.size();
      primes.push_back(i);
      max_prime = i;
    }
    for (int j = i; j <= m; ++j) {
      if (!is_prime[j]) {
        continue;
      }
      prime_id[j] = (int)primes.size();
      primes.push_back(j);
      max_prime = j;
    }
  }

  map<int, int> prime_factor(ll x) {
    map<int, int> ret;
    if ((ll)max_check * (ll)max_check < x) {
      return ret;
    }
    for (int i = 0; i < prime_number; ++i) {
      if (x == 1) {
        break;
      }
      while (x % primes[i] == 0) {
        x /= primes[i];
        ret[primes[i]] += 1;
      }
    }
    if (x != 1) {
      ret[x] += 1;
    }
    return ret;
  }
};

vi odd_divisors(int a) {
  while (a % 2 == 0) {
    a /= 2;
  }
  set<int> si_div;
  for (int i = 1; i * i <= a; i += 2) {
    if (a % i == 0) {
      si_div.insert(i);
      si_div.insert(a / i);
    }
  }
  //si_div.erase(1);
  vi ret;
  for (int d: si_div) {
    ret.push_back(d);
  }
  return ret;
}

vi primes;

vi odd_divisors_(int a) {
  vi ret;
  for (int d: primes) {
    if (d > a) {
      break;
    }
    if (a % d == 0) {
      ret.push_back(d);
    }
  }
  return ret;
}

int n;
using bs2e5 = bitset<200000>;
int maxn = 200000;
int mod = 998244353;
vll po2;

bool weak_bigger(bs2e5 a, bs2e5 b) {
  rep (i_, n) {
    int i = n-1 - i_;
    if (a[i] < b[i]) {
      return true;
    }
    if (a[i] > b[i]) {
      return false;
    }
  }
  return true;
}

ll count(int d, bs2e5 & bs) {
  assert (d >= 3);
  int section_size = n / d;
  ll ret = 0;
  auto cbs = bs2e5();
  rep (i, section_size) {
    if (bs[n-1 - i]) {
      ret = (ret + po2[section_size - 1 - i]) % mod;
      cbs[n-1 - i] = true;
    }
    //debug(ret);
  }
  cbs |= (cbs >> section_size);
  rep (i, section_size) {
    cbs.flip(n-1 - section_size - i);
  }
  int css = section_size * 2;
  while (true) {
    cbs |= (cbs >> css);
    css *= 2;
    if (css >= n) {
      break;
    }
  }
  //debug(cbs.to_string().substr(maxn - n, n));
  //debug(bs.to_string().substr(maxn - n, n));
  if (weak_bigger(cbs, bs)) {
    ret = (ret + 1) % mod;
  }
  return ret;
}

int main() {
  scan(n);
  string x;
  scan(x);
  //primes = Prime(maxn).primes;
  //primes.erase(begin(primes));

  po2.resize(200010);
  po2[0] = 1;
  rep (i, maxn) {
    po2[i + 1] = po2[i] * 2 % mod;
  }
  auto bs = bitset<200000>(x);
  //debug(bs);
  auto divs = odd_divisors(n);
  //sort(all(divs));
  int sz = divs.size();
  vll inex(sz, 0);
  for (int i = sz - 1; i > 0; --i) {
    inex[i] = count(divs[i], bs);
  }
  //debug(inex);

  inex[0] = 1;
  rep (i, n) {
    if (bs[i]) {
      inex[0] = (inex[0] + po2[i]) % mod;
    }
  }
  for (int i = sz - 1; i >= 0; --i) {
    FOR (j, i+1, sz) {
      if (divs[j] % divs[i] == 0) {
        inex[i] = (inex[i] + mod - inex[j]) % mod;
      }
    }
  }

  ll ans = 0;
  for (int i = sz - 1; i >= 0; --i) {
    int t = n / divs[i];
    ans = (ans + inex[i] * t * 2) % mod;
  }
  //debug(ds);
  //debug(inex);
  print(ans);

  return 0;
}


Measured memory_bytes: 4352