#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  vector<int> w(200000, 0);
  for (int i = 0; i < n; i++) cin >> v[i], w[v[i]]++;
  for (int i = 1; i < w.size() - 1; i++) {
    if (w[i] >= 1 && i != 1) {
      if (w[i - 1] == 0) w[i - 1] = 1, w[i]--;
    }
    if (w[i] >= 2) {
      w[i + 1]++, w[i]--;
    }
    if (w[i] != 0) w[i] = 1;
  }
  cout << count(w.begin() + 1, w.end(), 1);
  return 0;
}
