#include <bits/stdc++.h>
using namespace std;
long long bit_kosu[62];
int main() {
  long long n;
  cin >> n;
  for (long long(i) = 0; (i) < (long long)(n); ++(i)) {
    long long tmp;
    cin >> tmp;
    for (long long(j) = 0; (j) < (long long)(62); ++(j)) {
      if ((tmp >> j) & 1LL) {
        bit_kosu[j]++;
      }
    }
  }
  long long ans = 0;
  long long modint = 1000000007;
  for (long long(j) = 0; (j) < (long long)(62); ++(j)) {
    long long tmp = (long long)(1 << j);
    tmp %= modint;
    tmp *= (long long)(bit_kosu[j] * (n - bit_kosu[j]));
    tmp %= modint;
    ans += tmp;
    ans %= modint;
  }
  cout << ans << endl;
  return 0;
}
