#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int N;
  long int a;
  vector<long long int> P(61, 0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a;
    for (int j = 0; j < 61; j++) {
      if (a % 2l == 1) {
        P[j] += 1;
      }
      a = (long long int)(floor(a / 2l));
      if (a == 0) {
        break;
      }
    }
  }
  long long int mod = 1000000007ll;
  long long int total = 0;
  long long int base = 1;
  long long int t = 0;
  for (int i = 0; i < 61; i++) {
    t = P[i] * (N - P[i]);
    t %= mod;
    t = (t * base) % mod;
    total += t;
    total %= mod;
    base = base * 2;
    base %= mod;
  }
  cout << total << endl;
}
