Count of pairs with sum N from first N natural numbers | Function to calculate the value of count ; If n is even ; Count of pairs ; Otherwise ; Driver code
def numberOfPairs ( n ) : NEW_LINE INDENT if ( n % 2 == 0 ) : NEW_LINE INDENT return n // 2 - 1 ; NEW_LINE DEDENT else : NEW_LINE INDENT return n // 2 ; NEW_LINE DEDENT DEDENT n = 8 ; NEW_LINE print ( numberOfPairs ( n ) ) ; NEW_LINE