A few years ago, Aaron left his old school and registered at another due to security reasons. Now he wishes to find Jane, one of his schoolmates and good friends.

There are `n` schools numbered from 1 to `n`. One can travel between each pair of schools by buying a ticket. The ticket between schools `i` and `j` costs `(i + j) modulo (n + 1)` and can be used multiple times. Help Aaron find the minimum total cost to visit all schools. He can start and finish at any school.

Range : 1 ≤ n ≤ 10^(6)

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Mathematics

Starter code: def find_jane(n):
	

Solutions:
def find_jane(n):
	return (n - 1) // 2


import math

def find_jane(n):
	return math.ceil((n - 2) / 2)


find_jane = lambda n: n - 1 >> 1


def find_jane(n):
	return n - 1 >> 1


def find_jane(n):
	return n // 2 - 1 if n & 1 == 0 else n // 2


def find_jane(n):
	return sum(divmod(n, 2), -1)