#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <stack>
#include <bitset>
#include <queue>
#include <algorithm>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <cmath>
#include <cassert>
#include <random>

using namespace std;

void solve();

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif
    srand(time(0));
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

#define int long long

const int N = 101, A = 2e5 + 100, INF = 1e18;

int n, ans;
string f, s;

void solve() {
    cin >> n >> f >> s;
    vector < int > a, b;
    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == '1') a.push_back(i);
    }
    for (int i = 0; i < f.size(); i++) {
        if (f[i] == '0') continue;
        if (a.empty() || a.back() > i) b.push_back(i);
        else {
            ans += i - a.back();
            a.pop_back();
        }
    }
    if (b.size() % 2 == 1 || !a.empty()) {
        cout << -1;
        return;
    }
    for (int i = 0; i < b.size(); i += 2) {
        ans += b[i + 1] - b[i];
    }
    cout << ans;
}
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define vec vector
#define rip return 0
typedef long long ll;
typedef pair<ll,ll> P;
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(12);
  /*-------------------------------------------*/
  ll r,x,y;
  cin>>r>>x>>y;
  double eu=sqrt(x*x+y*y);
  ll ans=eu/r;
  if(r*ans==eu)cout<<ans<<endl;
  else if(eu>2*r) cout<<ans+1<<endl;
  else cout<<2<<endl;
}