#include <bits/stdc++.h>
using namespace std;
int a[150005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int last = 150005, nr = 0;
  for (int i = n; i >= 1; i--) {
    nr++;
    if (a[i] + 1 < last)
      last = a[i] + 1;
    else if (a[i] < last)
      last = a[i];
    else if (a[i] - 1 < last && a[i] - 1 > 0)
      last = a[i] - 1;
    else
      nr--;
  }
  printf("%d", nr);
  return 0;
}
