#include <stdio.h>
int main()
{
int i, n, x, s=0, max=0;
scanf(“%d”, &n);
for (i=0; i<n; i++)
{
scanf(“%d”, &x);
if (x>max)
max=x;
s+=x;
}
printf(“%d”, n*max-s);
return 0;
}
#include <stdio.h>
int main()
{
int i, n, x, s=0, max=0;
scanf(“%d”, &n);
for (i=0; i<n; i++)
{
scanf(“%d”, &x);
if (x>max)
max=x;
s+=x;
}
printf(“%d”, n*max-s);
return 0;
}