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

ll r, x, y;

int main()
{
    cin >> r >> x >> y;
    double d = sqrt(x * x + y * y);
    double num = d / r;
    double temp = d - ((ll)num * r);
    // cout << d << " " << num << " " << temp << endl;
    if (temp == 0)
        cout << (ll)num << endl;
    else
    {
        if ((ll)num == 0)
            cout << 2 << endl;
        else
            cout << (ll)num + 1 << endl;
    }
}
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <stack>
#include <queue>
#include <cassert>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int main(){
	int n;
	string s,t;
	cin >> n >> s >> t;
	
	ll ans = 0;
	queue<int> q;
	if(s[0]!=t[0]){
		q.push(0);
	}
	FOR(i,1,n){
		if(s[i]=='1' && !q.empty()){
			int x = q.front();
			q.pop();
			ans += i-x;
			s[i]='0';
		}
		
		if(s[i]!=t[i]){
			q.push(i);
		}
	}
	
	if(q.empty()){
		cout << ans << endl;
	}else{
		cout << "-1\n";
	}
	
	return 0;
}