#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n;
long long a[1000001];
long long cnt[201][2];
signed main() {
  scanf("%lld", &n);
  long long ans = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    for (long long j = 0; j <= 60; j++)
      ans += 1ll * (1ll << j) * cnt[j][((a[i] >> j) & 1) ^ 1], ans %= mod;
    for (long long j = 0; j <= 60; j++) cnt[j][((a[i] >> j) & 1)]++;
  }
  printf("%lld", ans);
  return 0;
}
