import java.util.*;

class Main {
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);

        System.out.print("Enter the number of host requirements: ");
        int n = sc.nextInt();

        int h;
        h = (int)Math.ceil((Math.log(n + 2)) / (Math.log(2)));

        printip(h);

        int net_bits = 32 - h;

        System.out.println("Total hosts per subnet = " + Math.pow(2, h));
        System.out.println("Usable hosts per subnet = " + (Math.pow(2, h) - 2));

        print_sub((int)Math.pow(2, (8 - h)), (int)Math.pow(2, h));
    }

    static void printip(int h) {

        int n = 0;
        int dec = 0;

        for (int i = 7; i >= h; i--) {
            dec = dec + (int)Math.pow(2, i);
        }

        System.out.println("255.255.255." + dec);
    }

    static void print_sub(int n, int diff) {

        int sum = 0;

        for (int i = 0; i < n; i++) {

            System.out.print("192.168.1." + sum);

            sum = sum + diff - 1;

            System.out.println(" -------- 192.168.1." + sum);

            sum++;
        }
    }
}
