1 #include"stdio.h"
2 int main()
3 {
4 int a[1001];
5 int count = 0,frontCount;
6 int n,i,result;
7 int max = 0;
8 scanf("%d",&n);
9 for(i=0;i<n;i++)
10 {
11 scanf("%d",a+i);
12 if(count == 0)
13 {
14 result = a[i];
15 frontCount = count;
16 count++;
17 }
18 else if(a[i] == result)
19 {
20 frontCount = count;
21 count++;
22 }
23 else
24 {
25 frontCount = count;
26 count--;
27 }
28 if(count > max)
29 max = count;
30 }
31 if((frontCount == 0 || count == 0 || count == max) && count != n)
32 printf("不存在");
33 else
34 printf("%d\n",result);
35 return 0;
36 }