CSES - Bit Problem
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Given a list of nn integers, your task is to calculate for each element xx:

  1. the number of elements yy such that xy=xx \mid y = x
  2. the number of elements yy such that x&y=xx \mathrel{\&} y = x
  3. the number of elements yy such that x&y0x \mathrel{\&} y \neq 0

Input

The first line has an integer nn: the size of the list.

The next line has nn integers x1,x2,,xnx_1,x_2,\dots,x_n: the elements of the list.

Output

Print nn lines: for each element the required values.

Constraints

  • 1n21051 \le n \le 2 \cdot 10^5
  • 1xi1061 \le x_i \le 10^6

Example

Input:

5
3 7 2 9 2

Output:

3 2 5
4 1 5
2 4 4
1 1 3
2 4 4