#include #define forn(i,n) for (int i = 0; i < n; i++) using namespace std; void swap (int *p1, int *p2) { int temp = *p1; *p1 = *p2; *p2 = temp; } int main() { int n,a[100]; cin>>n; forn(i,n) { cin>>a[i]; } for (int i = n-1; i > 0; i--) for (int j = 0; j < i; j++) { if (a[j] > a[j+1]) swap(a[j],a[j+1]); } int max = 0, p1 = 0, p2 = 0,i = 0; while (i < n) { int temp = a[i]; if (p1 == 0) { while (a[i] - temp == 0) { i++; p1++; } while (a[i] - temp == 1) { i++; p2++; } } else { while (a[i] - temp == 0) { i++; p2++; } } if (p1 + p2 > max) max = p1 + p2; if (a[i] - a[i-1] == 1) p1 = p2; else p1 = 0; p2 = 0; } cout<