#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  cin >> n;
  vector<long int> v;
  for (int i = 0; i < n; i++) {
    long int temp;
    cin >> temp;
    v.push_back(temp);
  }
  sort(v.rbegin(), v.rend());
  long int last = v[0] + 2;
  int counter = 0;
  for (int i = 0; i < n; i++) {
    if (v[i] + 1 <= 150001 && v[i] + 1 < last) {
      last = v[i] + 1;
      counter++;
    } else if (v[i] < last) {
      last = v[i];
      counter++;
    } else if (v[i] - 1 < last && v[i] - 1 > 0) {
      last = v[i] - 1;
      counter++;
    } else
      ;
  }
  cout << counter << endl;
}
