#include <bits/stdc++.h>
using namespace std;
using ll = long long;
class UnionFind {
  vector<int> par;
  vector<int> siz;

 public:
  UnionFind(int n) : par(n), siz(n, 1) {
    for (int i = 0; i < n; i++) {
      par[i] = i;
    }
  }
  int root(int x) {
    if (par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }
  bool same(int x, int y) { return root(x) == root(y); }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) {
      return 0;
    }
    if (siz[x] == siz[y]) {
      swap(x, y);
    }
    siz[x] += siz[y];
    par[y] = x;
    return 1;
  }
  int size(int x) { return siz[root(x)]; }
};
int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> a(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll cnt = n, check = 0;
  for (ll i = 0; i < n; i++) {
    check = 0;
    if ((a[i - 1] - a[i]) * (a[i - 1] - a[i]) <= 9) {
      if (i == n) {
        cnt--;
      }
      check++;
    }
    if ((a[i + 1] - a[i]) * (a[i + 1] - a[i]) <= 9) {
      if (i == 0) {
        cnt--;
      }
      check++;
    }
    if (check == 2) {
      cnt--;
    }
  }
  cout << cnt;
}
