Help me in solving MAXEQEASY problem

My issue

how can this 1 1 2 0 0 has 6 pairs when replaced 0’s with 1’s.
eg: 1 1 2 1 1 has equal pairs with indices (0,1), (0,3), (0,4), (1,3), (1,4) that equals to 5. plz explain

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner scan = new Scanner(System.in);
		int T = scan.nextInt();
		while(T-- >0){
		    int N = scan.nextInt();
		    ArrayList<Integer> arr = new ArrayList<>();
		    for(int i=0; i<N; i++){
		        int eachNum = scan.nextInt();
		    }
		    
		    
		}

	}
}

Problem Link: Equal Pairs (Easy) Practice Coding Problem

1 1 2 1 1 has 6 pairs as (0,1),(0,3),(0,4),(1,3),(1,4),(3,4).
Hint: if a array has n occurrences of a number then number of equal pairs of that number are (n*(n-1))/2.
In this case 1 has 4 occurrences so no of equal pairs are (4*3)/2 = 6.