#include <bits/stdc++.h>
using namespace std;
// hàm sắp xếp nổi bọt
void bbsort (int a[], int n) {
for (int i=0; i<n-1; i++) {
for (int j=0; j<n-i-1; j++) {
if (a[j]>a[j+1]) swap (a[j], a[j+1]);
}
}
}
int solve (int a[], int n) {
for (int i=0; i<n-1; i++) {
// nếu a[i+1]-a[i] =1 thì không thể chỉ có 1 đội quân
if (abs(a[i]-a[i+1])==1) return 2;
}
return 1;
}
int main () {
ios_base:: sync_with_stdio(false);
cin.tie(nullptr);
int n; cin >> n;
int a[n];
for (int i=0; i<n; i++) cin >> a[i];
bbsort (a, n);
cout << solve (a, n);
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Ci8vIGjDoG0gc+G6r3AgeOG6v3AgbuG7lWkgYuG7jXQKdm9pZCBiYnNvcnQgKGludCBhW10sIGludCBuKSB7Cglmb3IgKGludCBpPTA7IGk8bi0xOyBpKyspIHsKCQlmb3IgKGludCBqPTA7IGo8bi1pLTE7IGorKykgewoJCQlpZiAoYVtqXT5hW2orMV0pIHN3YXAgKGFbal0sIGFbaisxXSk7CgkJfQoJfQp9CgppbnQgc29sdmUgKGludCBhW10sIGludCBuKSB7Cglmb3IgKGludCBpPTA7IGk8bi0xOyBpKyspIHsKCQkvLyBu4bq/dSBhW2krMV0tYVtpXSA9MSB0aMOsIGtow7RuZyB0aOG7gyBjaOG7iSBjw7MgMSDEkeG7mWkgcXXDom4gCgkJaWYgKGFicyhhW2ldLWFbaSsxXSk9PTEpIHJldHVybiAyOwoJfQoJcmV0dXJuIDE7Cn0KCmludCBtYWluICgpIHsKCWlvc19iYXNlOjogc3luY193aXRoX3N0ZGlvKGZhbHNlKTsKCWNpbi50aWUobnVsbHB0cik7CgkKCWludCBuOyBjaW4gPj4gbjsKCWludCBhW25dOwoJZm9yIChpbnQgaT0wOyBpPG47IGkrKykgY2luID4+IGFbaV07CgliYnNvcnQgKGEsIG4pOwoJY291dCA8PCBzb2x2ZSAoYSwgbik7ICAgICAgICAgIAp9