// Arup Guha
// 7/19/05
// Solution to xyz.java

import java.io.*;

public class xyz {

  public static void main(String[] args) throws IOException {

    BufferedReader stdin = new BufferedReader
				(new InputStreamReader(System.in));

    // Get user input.
    System.out.println("What is the value of n?");
    int n = Integer.parseInt(stdin.readLine());

    System.out.println("What is the minimum value of x?");
    int minX = Integer.parseInt(stdin.readLine());

    System.out.println("What is the maximum value of z?");
    int maxZ = Integer.parseInt(stdin.readLine());

    int total=0;

    // Loop through all possibilities of x and y, with x < y.
    for (int x=minX; x<maxZ; x++) {
      for (int y=x+1; y<maxZ; y++) {
 
        // Calculate the only possible value of z for this case.
        int z = n - x - y;

        // Check if z conforms to the given rules.
        if (z > y && z <= maxZ) {
          total++;
          System.out.println("x = "+x+" y = "+y+" z = "+z);
        }

      } // end for y
    } //  end for x

    System.out.println("There were "+total+" solutions to the equation.");

  } // end main


}
