Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Arshiya's First Code

By TarifEzaz · Limits 500ms, 512 MB

Arshiya is just three and she already started programming. She has learned how to write loops. Recently, she found a simple problem written in the exercises segment of her programming book. The problem says, "Given a positive integer NN, find the number of odd numbers from 1 to NN inclusive". Arshiya thought to herself, "It's a piece of cake" and wrote down the following code to solve the problem:

 1#include <stdio.h>
 2
 3int main() {
 4     int N;
 5     scanf("%d",&N);
 6     int countOdd = 0;
 7
 8     for (int i = 0; i < N; i++) {
 9            if ((i+1)%2 == 1) {
10                  countOdd++;
11            } 
12     }
13     printf("%d\n", countOdd);
14     return 0; 
15}

Excited with her achievement, Arshiya came to you and showed her code. Little did Arshiya know that her code is not optimized. In this problem, your task is to solve Arshiya's problem, efficiently.

Input

The input contains a single positive integer NN (1N2×10171 \le N \le 2\times10^{17}), the value up to which you have to calculate the odd numbers.

Output

Output a single number, the result of the problem.

Sample

InputOutput
1
1

Discussion

Statistics


91% Solution Ratio

Gulam_KibriaEarliest, Oct '19

Gulam_KibriaFastest, 0.0s

Gulam_KibriaLightest, 0 B

touhidurrrShortest, 18B

Submit

Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.