var a,c:array[0..70000]of longint;
n,ans,i:longint;
procedure merge(l,r:longint);
var i,j,t,mid:longint;
begin
i:=l; j:=(l+r)>>1+1; mid:=j-1; t:=i;
while t<=r do
begin
if (i<=mid)and((a[i]<=a[j])or(j>r)) then
begin
inc(ans,j-mid-1);
c[t]:=a[i];
inc(i);
end
else
begin
//inc(ans,mid-i+1);
c[t]:=a[j];
inc(j);
end;
inc(t);
end;
for i:=l to r do a[i]:=c[i];
end;
procedure fen(l,r:longint);
begin
if l<r then
begin
fen(l,(l+r)>>1);
fen((l+r)>>1+1,r);
merge(l,r);
end;
end;
begin
assign(input,'px.in');reset(input);assign(output,'px.out');rewrite(output);
readln(n);
for i:=1 to n do read(a[i]);
ans:=0;
fen(1,n);
//for i:=1 to n do write(a[i],' ');
writeln(ans);
close(input);close(output);
end.