{int@n,@a(n),b,c;rep(i,n)a[i]&&b+=c,!a[i]&&{c=i+1,b+=i+1};wt(b);}