#K15431. Max 2x2 Operations to Fill Grid

    ID: 24355 Type: Default 1000ms 256MiB

Max 2x2 Operations to Fill Grid

Max 2x2 Operations to Fill Grid

You are given an integer n representing the size of an n x n grid. Your task is to calculate the maximum number of 2x2 sub-grid operations that can be performed on the grid. Each operation fills a 2x2 sub-grid with 1s. It can be shown that the maximum number of such independent operations is given by the formula: $$ (n-1)^2 $$.

For example:

  • If n = 1, then no 2x2 sub-grid exists, and the result is 0.
  • If n = 2, then exactly one 2x2 sub-grid exists, and the result is 1.
  • If n = 3, there are four possible placements, resulting in 4 operations.

Write a program that reads an integer from standard input and outputs the maximum number of operations to standard output.

inputFormat

The input consists of a single integer n (1 ≤ n ≤ 109), read from standard input.

outputFormat

Output a single integer representing the maximum number of 2x2 operations that can be applied to an n x n grid, which is computed as $$ (n-1)^2 $$.

## sample
1
0