#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, i, prev, ans;
  cin >> n;
  long long int A[n];
  for (i = 0; i < n; i++) cin >> A[i];
  sort(A, A + n);
  prev = A[0];
  ans = 1;
  if (prev > 1) prev = prev - 1;
  for (i = 1; i < n; i++) {
    if (A[i] - 1 > prev) {
      prev = A[i] - 1;
      ans++;
    } else if (A[i] > prev) {
      prev = A[i];
      ans++;
    } else if (A[i] + 1 > prev) {
      prev = A[i] + 1;
      ans++;
    }
  }
  cout << ans;
  return 0;
}
