#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, key;
  cin >> n >> k;
  int a[n];
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int count = 0;
  v.push_back(a[0]);
  for (int i = 0; i < n - 1;) {
    key = a[i];
    for (int j = i + 1; j < n; j++) {
      if (abs(key - a[j]) <= 3) {
        v.push_back(a[j]);
        i = j;
        break;
      }
    }
  }
  cout << v.size() << endl;
}
