Maximize count of equal numbers in Array of numbers upto N by replacing pairs with their sum | Java implementation of the above approach ; Function to count maximum number of array elements equal ; Driver Code ; Function call
import java . io . * ; class GFG { static int countEqual ( int n ) { return ( n + 1 ) / 2 ; } public static void main ( String [ ] args ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 , 6 } ; int n = arr . length ; System . out . println ( countEqual ( n ) ) ; } }