#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int main(){
    int N; cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    vector<ll> c(200, 0);
    for (int i = 0; i < N; i++) {
        c[a[i] % 200]++;
    }
    ll ans = 0;
    for (ll i = 0; i < 200; i++) {
        ans += c[i] * (c[i] - 1) / 2;
    }
    cout << ans << endl;


}
#include<bits/stdc++.h>
using namespace std;
#define N 500050
typedef long long ll;
inline ll read(){
	ll x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,a[N],b[N],ans;
char s[N],t[N];
int main(){
	n=read();
	scanf("%s",s+1);
	scanf("%s",t+1);
	int sa=0,sb=0;
	for(int i=1;i<=n;++i)a[i]=s[i]-'0',sa+=a[i],b[i]=t[i]-'0',sb+=b[i];
	if(sa^sb)return !printf("-1\n");
	int i=1,j=1;
	while(true){
		while(i<=n&&a[i])++i;
		while(j<=n&&b[j])++j;
		if(i>n&&j>n)break;
		if(i^j)++ans;
		++i,++j;
	}
	printf("%d\n",ans);
	return 0;
}

