### PROBLEM LINK:

**Author:** Vivek Hamirwasia

**Tester:** Mahbubul Hasan

**Editorialist:** Jingbo Shang

### DIFFICULTY:

Cakewalk

### PREREQUISITES:

Simple Math

### PROBLEM:

Given a sequence of numbers **A[1…N]**, find the number of pairs of **i, j (i < j)**, such that **A* * A[j] > A* + A[j]**.

### EXPLANATION:

This problem is similar to this one occurred in OCT Long 2013. It is easy to find that if both **A*** and **A[j]** are greater than or equal to 2, the inequality **A* * A[j] > A* + A[j]** always holds. It is worth noting that, if any one of **A*** and **A[j]** is 0 or 1, the inequality will never hold. It is also not held for both numbers are 2.

Denote **C2** as the number of 2s in the given array. And **C** is the number of numbers which are greater than 2.

As analyzed before, the answer is **C2 * C + C * (C - 1) / 2**.

### AUTHOR’S AND TESTER’S SOLUTIONS:

Author’s solution can be found here.

Tester’s solution can be found here.