Sum of Two Integers

AtCoder
IDnikkei2019_2_qual_a
Time2000ms
Memory256MB
Difficulty
How many ways are there to choose two distinct positive integers totaling $N$, disregarding the order? ## Constraints * $1 \leq N \leq 10^6$ * $N$ is an integer. ## Input Input is given from Standard Input in the following format: $N$ [samples]
Samples
Input #1
4
Output #1
1

There is only one way to choose two distinct integers totaling $4$: to choose $1$ and $3$. (Choosing $3$ and $1$ is not considered different from this.)
Input #2
999999
Output #2
499999
API Response (JSON)
{
  "problem": {
    "name": "Sum of Two Integers",
    "description": {
      "content": "How many ways are there to choose two distinct positive integers totaling $N$, disregarding the order?",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "nikkei2019_2_qual_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "How many ways are there to choose two distinct positive integers totaling $N$, disregarding the order?\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^6$\n*   $N$ is an integer.\n\n## Input\n\nInput is given from S...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments