#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const long long mod = 998244353;
const long long INF = 1LL << 60;
int main() {
  int n, k;
  cin >> n >> k;
  int ans = n;
  int a = 1;
  vector<int> A(n);
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = i; j > i - a; j--) {
      if (abs(A[i] - A[j - 1]) <= 3) {
        ans = ans - (a - 1);
        a = 0;
        break;
      }
    }
    a++;
  }
  cout << ans << "\n";
}
