#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  int prev = 0, ans = 0;
  for (int i = 0; i < n; i++) {
    for (int add = -1; add <= 1; add++) {
      if (prev < a[i] + add) {
        prev = a[i] + add;
        ans++;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
