#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long md = 1e9 + 7;
  vector<long long> one(63, 0), zero(63, 0);
  long long score = 0;
  for (int i = 0; i < N; i++) {
    long long A;
    cin >> A;
    for (int i = 0; i < 63; i++) {
      if (A & 1) {
        one[i]++;
      } else {
        zero[i]++;
      }
      A >>= 1;
    }
  }
  long long hoge = 1;
  for (int i = 0; i < 63; i++) {
    score += one[i] * zero[i] % md * score;
    score %= md;
    hoge *= 2;
    hoge %= md;
  }
  cout << score << endl;
}
