#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin>>n;
	int arr[n];
	for(int i=0; i<n; i++){
		cin>>arr[i];
	}
	multiset<int>s;
	s.insert(arr[0]);
	for(int i=1; i<n; i++){
		int val=arr[i];
		auto it=s.begin();
		int vals=(*it);
		if(val<=vals){
			s.insert(val);
			continue;
		}
		it=s.end();
		it--;
		vals=(*it);
		if(vals<val){
			s.erase(s.find(vals));
			s.insert(val);
			continue;
		}
		it=s.lower_bound(val);
		it--;
		s.erase(s.find((*it)));
		s.insert(val);
	}
	cout<<s.size();
	return 0;
}
#include <iostream>
#include <vector>
using namespace std;

int main(){
	int n;
	cin>>n;
	
	int a[n+2];
	a[0]=0;
	a[n+1]=0;
	for(int i=1;i<=n;i++)
		cin>>a[i];
		
	int b[n+1]; //b[i]=cost of i->i+1
	int sum=0;
	for(int i=0;i<=n;i++){
		b[i]=abs(a[i+1]-a[i]);
		sum+=b[i];
	}
	
	for(int i=1;i<=n;i++)
		cout<<sum-b[i-1]-b[i]+abs(a[i+1]-a[i-1])<<endl;
}
