package atcoder;

import java.util.Scanner;

public class atcoder01 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int a =sc.nextInt();
		int b =sc.nextInt();
		int x =sc.nextInt();
		int count=0;
		for(int i=0;a<b;i++){
			int z=0;
			a=a+i;
			if((z+a)/x==0){
				count=count+1;
			}
		}
		System.out.println(count);
		
	}

}