#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (auto &x : v) cin >> x;
  sort(v.begin(), v.end());
  int z = 0, count = 0;
  for (auto y : v) {
    if (y - 1 > z) {
      count++;
      z = y - 1;
    } else if (y - 1 == z) {
      count++;
      z = y;
    } else if (y == z) {
      z = y + 1;
      count++;
    }
  }
  cout << count;
  return 0;
}
