#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (auto &i : v) {
    cin >> i;
  }
  long long last = 150002;
  sort(v.begin(), v.end());
  long long ans = 0;
  for (long long i = n - 1; i >= 0; i--) {
    if (v[i] + 1 >= last) {
      if (v[i] >= last) {
        if (v[i] == 1 || v[i] - 1 >= last) {
        } else {
          ans++;
          last = v[i] - 1;
        }
      } else {
        ans++;
        last = v[i];
      }
    } else {
      ans++;
      last = v[i] + 1;
    }
  }
  cout << ans;
}
