#pragma GCC optimize("Ofast") // yukicoder@cpp #include using namespace::std; //struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout< // #include // #include // #include // #include // #include // #include // #include // #include // using boost::math::tools::brent_find_minima; // #include // #include // namespace mp = boost::multiprecision; // typedef mp::number> cdouble; // typedef mp::cpp_int cint; #include #include #include #include templateusing pbds=__gnu_pbds::tree,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; templateusing pbds_map=__gnu_pbds::tree,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; templateusing pqueue =__gnu_pbds::priority_queue,__gnu_pbds::rc_binomial_heap_tag>; typedef long long lint; typedef long long ll; typedef long double ldouble; typedef vector vec; typedef vector> mat; typedef vector>> mat3; typedef vector dvec; typedef vector> dmat; typedef vector>> dmat3; typedef vector svec; typedef vector> smat; typedef vector>> smat3; typedef vector> pvec; typedef vector>> pmat; typedef vector>>> pmat3; #define rep(i, n) for(lint i = 0; i < (lint)(n); i++) #define irep(i) for(lint i = 0;; i++) #define irep1(i) for(lint i = 1;; i++) #define irep2(i) for(lint i = 2;; i++) #define rrep(i, n) for(lint i = (lint)(n-1); i >-1; i--) #define rrepi(i,a,b) for(lint i = (lint)(b-1); i >a-1; i--) #define repi(i,a,b) for(lint i=lint(a);ilint(b);i+=c) #define all(x) (x).begin(),(x).end() #define PI 3.141592653589793 #define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5)) #define input(a,n) lint n;cin>>n;vectora(n);rep(i,n)cin>>a[i]; #define SUM(v) accumulate(all(v),0LL) #define INF (1LL<<60) #define IINF (1<<30) #define EPS (1e-10) #define LINF 9223372036854775807 //#define MOD 998244353LL #define MOD 1000000007LL #define endl "\n" templateinline void numout(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<inline void numout2(T t){for(auto i:t)numout(i);} templateinline void output(T t){bool f=0;for(auto i:t){cout<<(f?" ":"")<inline void output2(T t){for(auto i:t)output(i);} templateinline void _output(T t){bool f=0;for(int i=0;iinline void _output2(T t){for(int i=0;iT in(){return *istream_iterator(cin);} templateinline T gcd(T a,T b){return b?gcd(b,a%b):a;} templateinline T lcm(T a,T b){return a/gcd(a,b)*b;} templateinline T minq(T a,T b){return min(a,b);} inline bool chmin(auto& s,const auto& t){bool res=s>t;s=min(s,t);return res;} inline bool chmax(auto& s,const auto& t){bool res=s dx={-1,1,0,0,1,1,-1,-1}; vector dy={0,0,-1,1,1,-1,1,-1}; // #define rep(i, n) for(lint i = 0; i < (lint)(n); i++) // templateclass RBST{ // struct node;using np=node*; // struct node{ // np ch[2];K key;V val; // node(K key,V val):key(key),val(val){} // }; // np root; // public: // int size(){return count(root);} // private: // np merge(np p,np q,np r){return merge(p,merge(q,r));} // tuple split(np t,K l,K r){auto s=split(t,l);return make_tuple(s.first,split(s,r));} // mt19937 rnd(random_device()); // np merge(vector t,bool f=0){ // if(f)swap(t[0],t[1]); // rep(i,2)if(!t[i])return t[1-i]; // bool b=count(t[0])>rnd()%(count(t[0])+count(t[1])); // t[1-b]->ch[b]=merge(t[b],t[1-b]->ch[b],b); // return update(t[1-b]); // } // pair split(np t,K k){ // if(!t)return make_pair(nullptr,nullptr); // bool b=k>t->key; // auto s=split(t->ch[b],k); // t->ch[b]=b?s.first:s.second; // return b?make_pair(update(t),s.second):make_pair(s.first,update(t)); // } // }; random_device seed; default_random_engine engine(seed()); negative_binomial_distribution<> rnd(1,0.5); templateclass SkipList{ using P=T*; list

v[5]; public: void push_back(T val){ P p=new T(val); rep(i,max(5,rnd(engine)+1))v[i].push_back(p); } void insert(T val){ } }; lint bs(lint mn,lint mx,function func) { lint left = mn-1; lint right =mx; while (right - left > 1) { lint mid = left + (right - left) / 2; if (!func(mid)) right = mid; else left = mid; } return left; } int main(){ lint n; cin>>n; vec a(n); rep(i,n)cin>>a[i]; rep(i,n-1)a[i+1]+=a[i]; lint ans=0; rep(i,n)ans+=abs(a[i]-i-1); cout<