#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, i, j, k, x, c = 0;
  cin >> n;
  int dp[150002] = {0};
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (x = 0; x < n; x++) {
    i = a[x];
    if (dp[i + 1] > 0) continue;
    if (dp[i] == 0) {
      if (i == 1) {
        dp[i]++;
      } else {
        if (dp[i - 1] == 0)
          dp[i - 1]++;
        else
          dp[i]++;
      }
    } else
      dp[i + 1]++;
  }
  for (i = 1; i <= 150001; i++) {
    if (dp[i] > 0) c++;
  }
  cout << c;
  return 0;
}
