#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
signed main(void) {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  for (long long bit = 0; bit < (61); bit++) {
    long long x = 0;
    long long t = 1LL << bit;
    for (long long i = 0; i < (n); i++)
      if (a[i] & t) x++;
    if (x == 0 || x == n) continue;
    t %= 1000000007;
    ans += x * (n - x) * t % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
