Function to count the elements such that their exist a subarray whose sum is equal to this element
function countElement ( arr , n ) { let freq = Array . from ( { length : n + 1 } , ( _ , i ) => 0 ) ; let ans = 0 ;