#include <iostream>
#include <cmath>
#include <vector>
#include <cstdlib>
#include <cstdio>

using namespace std;

long long gcd(long long a, long long b)
{
    while (a && b)
    {
        if (a > b)
        {
            a %= b;
        }
        else
        {
            b %= a;
        }
    }
    return max(a, b);
}

long long abss(long long a)
{
    if (a < 0)
    {
        return -a;
    }
    return a;
}

int main()
{
    freopen("supper.in", "r", stdin);
    freopen("supper.out", "w", stdout);
    long long x0, y0, R, x1, y1, x2, y2, dx, dy, d, t1, t2;
    long double a, b, c, D;
    cin >> x0 >> y0 >> R >> x1 >> y1 >> x2 >> y2;
    d = gcd(abss(x2 - x1), abss(y2 - y1));
    dx = (x2 - x1) / d;
    dy = (y2 - y1) / d;
    a = dx * dx + dy * dy;
    b = 2 * dx * x1 + 2 * dy * y1 - 2 * dx * x0 - 2 * dy * y0;
    c = x1 * x1 + y1 * y1 - 2 * x0 * x1 - 2 * y0 * y1 + x0 * x0 + y0 * y0 - R * R;
    D = b * b - 4 * a * c;
    if (D < 0)
    {
        return cout << 0, 0;
    }
    t1 = ceil((-b - sqrtl(D)) / (a * 2));
    t2 = floor((-b + sqrtl(D)) / (a * 2));
    cout << max((long long)0, t2 - t1 + 1);
    return 0;
}
