#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, i, j, x, y, z, ans = 0;
  string s;
  bool flag;
  vector<long long> v;
  ;
  cin >> m >> n;
  j = m;
  while (j--) {
    cin >> x;
    v.push_back(x);
  }
  if (v.size() == 1) {
    cout << 1 << endl;
  } else {
    for (i = 0; i < v.size() - 1; i++) {
      for (j = i + 1; j < v.size(); j++) {
        if (abs(v[i] - v[i + 1]) <= 3) {
          ans++;
          i = j - 1;
          j = i;
        } else {
          i--;
        }
      }
    }
  }
  cout << ans + 1 << endl;
}
