#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
template <class T = long long>
T input() {
  T x;
  cin >> x;
  return x;
}
template <class T>
void output(T x) {
  cout << x << endl;
}
int main() {
  long long N = input();
  vector<long long> A;
  for (long long i = 0; i < N; i++) {
    long long a = input();
    A.push_back(a);
  }
  const long long bitNum = 62;
  vector<long long> res;
  for (long long i = 0; i < bitNum; i++) {
    long long count1 = 0;
    long long count0 = 0;
    for (auto iter : A) {
      if (iter & ((long long)1 << i)) {
        count1++;
      } else {
        count0++;
      }
    }
    res.push_back(count1 * count0);
  }
  long long ret = 0;
  const long long l = pow(10, 9) + 7;
  for (long long i = 0; i < res.size(); i++) {
    long long a = ((res[i] % l) * (((long long)1 << i))) % l;
    ret += a;
  }
  output(ret % l);
  return 0;
}
