#include <bits/stdc++.h>
using namespace std;
int main() {
    long long a, b, x;
    cin >> a >> b >> x;
    long long A = b/x, B = (a-1)/x;
    if (a!=0) cout << A - B << endl;
    if (a==0) cout << A + 1 << endl;
    return 0;
}