Vera's Fashion
InterviewTime limit2sMemory limit256 MB
Given N tops and N bottoms colored 1 to N, count how many top and bottom pairs have different colors.
- Level
Easy1 of 10
- Topics
- Math, Combinatorics, Implementation
- Solved
- No attempts yet
Problem
Vera owns tops and bottoms. The -th top and the -th bottom both have color . The colors are all different.
Vera picks one top and one bottom. How many such pairs have a top and a bottom of different colors?
Input
The input is given in the following form.
N
Output
Print the number of pairs whose top and bottom have different colors, on one line.
Constraints
- is an integer.