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