#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <limits>
#include <string>
#include <algorithm>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include "math.h"
#include "assert.h"

using namespace std;

#define ll long long


#define config ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout.precision(20);
#define epsilon 1e-07
#define pi 2 * acos(0.0);
#define mod 1000000007   // 1e9+7
#define cerr if(false)cerr
#define watch(x) cerr << #x << " = " << x << endl;

#define iv vector<int>
#define xy pair<int, int>
#define x first
#define y second 

#define inf std::numeric_limits<int>().max()

int main() {
	config;
	ll n;
	cin >> n;
	string t;
	cin >> t;
	ll sz = 1e10;
	ll k = n / 3;
	ll ans = 0;
	if (n < 3) {
		if (t == "0") ans = sz;
		if (t == "1") ans = 2*sz;
		if (t == "00") ans = 0;
		if (t == "01") ans = sz-1;
		if (t == "10") ans = sz;
		if (t == "11") ans = sz;
	} else {
		set<string> s;
		s.insert("110");
		s.insert("011");
		s.insert("101");
		string p = t.substr(0,3);
		if (s.count(p)) {
			bool ok = true;
			for(int i=0; i<k*3; i+=3) {
				if (p != t.substr(i, 3)) ok = false;
			}
			if (ok) {
				ll zeros = 0;
				for(int i=0; i<n; i++) {
					if (t[i] == '0') zeros++;
				}
				ans = sz - zeros;
				if (t[t.size()-1] == '0') ans++;
			}
		}
	}
	cout << ans << '\n';
}

#include<bits/stdc++.h>
using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
#define DRT() int t; si(t); while(t--)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//# define M_PI           3.14159265358979323846264338327950288
// DSU

void IO(){
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	off;
}

int main(){
	IO();
	LL s,p;
	cin>>s>>p;
	LL ok = 0;
	for(LL i=1;i*i <= p;i++){
		LL rem = p % i;
		if(rem == 0){
			LL d = p/i;
			if(i + d == s)
				ok = 1;
		}
	}
	if(ok)
		dout("Yes");
	else
		dout("No");
	return 0;
}