program tinh_tong_va_dem_so_x;
const
MAX = 100;
var
a: array[1..MAX] of integer;
n, tong, x, dem, i: integer;
begin
write('Nhap so phan tu cua mang: ');
readln(n);
for i := 1 to n do
begin
write('Nhap phan tu thu ', i, ': ');
readln(a[i]);
end;
tong := 0;
for i := 1 to n do
begin
tong := tong + a[i];
end;
writeln('Tong cac phan tu trong mang la: ', tong);
write('Nhap gia tri x: ');
readln(x);
dem := 0;
for i := 1 to n do
begin
if a[i] = x then
begin
dem := dem + 1;
end;
writeln('So lan xuat hien cua ', x, ' trong mang la: ', dem);
readln;
end.