Under construction

Still being built. Things may change

Bishop

Time limit2sMemory limit128 MB

Summary
Given board size N as a big number up to 70 digits, compute the maximum bishops placeable on an N by N board without mutual attacks, which is 2N-2 (or 1 if N=1).
Level

Medium4 of 10

Topics
Math, String, Implementation
Solved
No attempts yet

Problem

You are given an N*N chessboard. A bishop can move any distance along each of the four diagonal directions from its current square, and it can attack another bishop on the same diagonal.

Place as many bishops as possible on the board so that no two bishops attack each other. Given the board size N, write a program that prints the maximum number of bishops that can be placed.

Input

The board size N is given. N is a positive integer written in decimal notation, and it has at most 70 digits.

Output

Print the maximum number of bishops that can be placed so that no two attack each other.

Examples2

  1. Example 1

    Input
    3
    
    Expected output
    4
    
  2. Example 2

    Input
    2
    
    Expected output
    2