Code Submission Evaluation System Login

CSES Problem Set

Bit Problem


Task | Statistics


CSES - Bit ProblemCSES - Bit Problem

Time limit:1.00 s Memory limit:512 MB

Given a list of $n$ integers, your task is to calculate for each element $x$:
  1. the number of elements $y$ such that $x \mid y = x$
  2. the number of elements $y$ such that $x \mathrel{\&} y = x$
  3. the number of elements $y$ such that $x \mathrel{\&} y \neq 0$
Input

The first input line has an integer $n$: the size of the list.

The next line has $n$ integers $x_1,x_2,\dots,x_n$: the elements of the list.

Output

Print $n$ lines: for each element the required values.

Constraints
Example

Input:
5
3 7 2 9 2


Output:
3 2 5
4 1 5
2 4 4
1 1 3
2 4 4