#include <bits/stdc++.h>   using namespace std;   int arr[200000], arr2[200000];   int main() {     int n, i;     long long sum = 0;     scanf( %d , &n);     for (i = 0; i < n; i++) {       scanf( %d , &arr[i]);       arr2[i] = arr[i] + arr2[i - 1];     }     for (i = 0; i < n; i++) {       if (arr[i] == 0) {         sum += arr2[i];       }     }     cout << sum;     return 0;   }   