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

int main()
{
    ll a,b,x,ans;
    while(scanf("%lld%lld%lld",&a,&b,&x)!=EOF)
    {
        ans=b/x;
        if(a!=0) ans-=(a-1)/x;
        else ans++;
        printf("%lld\n",ans);
    }
    return 0;
}
