#include <bits/stdc++.h>
using namespace std;

int main(){
  int N;
  cin >> N;
  unsigned long long a[N],a_max,b[N],b_max,c;
  for(int i=0;i<N;i++){
    cin >> a[i];
  }
  for(int i=0;i<N;i++){
    cin >> b[i];
  }
  c = a[0]*b[0];
  a_max=a[0];
  b_max=b[0];
  cout << c << endl;
  for(int i=1;i<N;i++){
    if(a_max < a[i]) a_max=a[i];
    if(c < a_max*b[i]) c = a_max*b[i];
    cout << c << endl;
  }
  return 0;
}
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;

using namespace std;
#define  start     ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define  int       long long
#define  ll        long long
#define  vi        vector<int>
#define  pb        push_back
#define  mod       1000000007
#define  all(v)    v.begin(),v.end()
#define  maxv(a)   *max_element(all(a))
#define  minv(a)   *min_element(all(a))
#define  sumv(a)    accumulate(all(a),0)
//#define  endl       '\n'

typedef tree< int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update > ordered_set; 
//0 based index
//cout<<*X.find_by_order(1)<<endl; // iterator to the k-th element
// cout<<X.order_of_key(-5)<<endl;  // number of items in a set that are strictly smaller than our item

int gcd(int a,int b){
	return __gcd(a,b);
}
int lcm(int a,int b){
	return a*(b/gcd(a,b));
}
bool isprime(int n){
	if(n<=1)return false;
	for(int i=2;i*i<=n;i++){
		if(n%i==0)return false;
	}
	return true;
}

vector<int>divisor(int n)
{
	vector<int>v;
	for(int i=1;i*i<=n;i++){
		if(i*i==n)v.pb(i);
		else if(n%i==0){
			v.pb(i);
			v.pb(n/i);
		}
	}
	return v;	
}

const int MX=1e6+123;
vector<int>fact[MX];
bool is_prime[MX];
vector<int>primes;

void sieve(int n){
	
	for(int i=3;i<=n;i+=2)is_prime[i]=1;
	for(int i=3;i*i<=n;i+=2){
		if(is_prime[i]==1){
			for(int j=i*i;j<=n;j+=(i+i)){
				is_prime[j]=0;
			}
		}
	}
	is_prime[2]=1;
	primes.pb(2);
	for(int i=3;i<=n;i++){
		if(is_prime[i]==1){
			primes.pb(i);
		}
	}
}

vector<int>primefactor(int n){
	
	vector<int>v;
	for(auto p:primes){
		if(1LL*p*p>n)break;
		if(n%p==0){
			while(n%p==0){
				v.pb(p);
				n/=p;
			}
		}		
	}
	if(n>1)v.pb(n);
	return v;
}
int sumofDigit(int n)
{
    int sum=0;
	while(n!=0)
	{
		sum+=n%10;
		n/=10;
	}
	return sum;
}
bool isPalindrome(string s)
{
	int l=0;
	int h=s.size()-1;
	while(l<h)
	{
		if(s[l++]!=s[h--])
		{
			return false;
		}
	}
	return true;
	
}
int reverse(int x){
	int rev=0,rem;
	while(x!=0){
		rem=x%10;
		rev=rev*10+rem;
		x/=10;
	}
	return rev;
}

void solve(){	
	int n;
	cin>>n;
	vi v(n);
	map<int,int>mp;
	for(int i=0;i<n;i++){
		cin>>v[i];
		mp[v[i]%200]++;
	}
	int ans=0;
	for(auto x:mp){
		ans+=(x.second*(x.second-1))/2;
	}
	cout<<ans<<endl;
	

}

signed main()
{
	start;
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	
}
