#include <stdio.h>
int a[120];
int main(void)
{
freopen("countb.in", "r", stdin);
freopen("countb.out", "w", stdout);
int n, ans, i, j, k, yes;
scanf("%d", &n);
for (i = 1; i <= n; i++)
scanf("%d", &a[i]);
for (i = 1, ans = 0; i <= n; i++)
{
for (j = 1, yes = 0; j <= n; j++)
{
for (k = 1; k <= n; k++)
if (a[i] == a[j] + a[k] && i != j && j != k && i != k)
{
ans++;
yes = 1;
break;
}
if (yes)
break;
}
}
printf("%d\n", ans);
fclose(stdin);
fclose(stdout);
return 0;
}