#include <bits/stdc++.h>
using namespace std;
int fx4[] = {+1, -1, +0, +0};
int fy4[] = {+0, +0, +1, -1};
int fx8[] = {+0, +0, +1, -1, -1, +1, -1, +1};
int fy8[] = {-1, +1, +0, +0, +1, +1, -1, -1};
const int mxx = 1e5 + 1;
void cal() {
  int n, k;
  cin >> n >> k;
  vector<int> vcc(n);
  for (auto &x : vcc) cin >> x;
  vector<int> res;
  int c = 0;
  for (int i = 0; i < n; i++) {
    int p = vcc[i];
    for (int j = 0; j < n; j++) {
      if (abs(p - vcc[j]) == 3) {
        c++;
        res.push_back(vcc[j]);
        p = vcc[j];
        vcc[i] = -100000000;
        vcc[j] = -100000000;
      }
    }
  }
  cout << c + 1 << endl;
}
void solve() {
  long long t = 1;
  while (t--) cal();
}
int main() {
  solve();
  return 0;
}
