import java.util.*;
时间: 2024-05-22 19:15:46 浏览: 107
Util.java
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] = scanner.nextInt();
}
Arrays.sort(nums);
int maxCount = 0;
int currentCount = 1;
for (int i = 1; i < n; i++) {
if (nums[i] == nums[i-1]) {
currentCount++;
} else {
maxCount = Math.max(maxCount, currentCount);
currentCount = 1;
}
}
maxCount = Math.max(maxCount, currentCount);
System.out.println(maxCount);
}
}
阅读全文