#include #include using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m, p; cin >> n >> m; vector> S; vector b(n); iota(b.begin(), b.end(), 0); for(int i = 0; i < m; i++){ cin >> p, p--; S.emplace_back(minmax(b[p], b[p + 1])); swap(b[p], b[p + 1]); } sort(S.begin(), S.end()); S.erase(unique(S.begin(), S.end()), S.end()); cout << S.size() << '\n'; }