#include <bits/stdc++.h>
using namespace std;
long long int my_binary_search(long long int ary[], long long int key,
                               long long int left, long long int right) {
  long long int middle;
  if (right < left) {
    return -((long long)(1e18 + 1));
  } else {
    middle = left + (right - left) / 2;
    if (ary[middle] > key) {
      return my_binary_search(ary, key, left, middle - 1);
    } else if (ary[middle] < key) {
      return my_binary_search(ary, key, middle + 1, right);
    } else {
      return middle;
    }
  }
}
struct UnionFind {
  vector<int> par;
  UnionFind(int N) : par(N) {
    for (int i = 0; i < N; i++) par[i] = i;
  }
  int root(int x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
  bool same(int x, int y) {
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }
};
int main(void) {
  long long int N, M;
  cin >> N;
  vector<long long int> A(N);
  long long int mmm = 0;
  for (int(i) = int(0); (i) < int(N); (i)++) {
    cin >> A[i];
    mmm = max(mmm, A[i]);
  }
  long long int ans = 0;
  long long int buf;
  long long int ct0, ct1;
  long long int pow2;
  for (long long int i = 60; i >= 0; i--) {
    pow2 = (long long int)(pow(2, i));
    ct0 = 0;
    ct1 = 0;
    buf = 0;
    for (long long int j = 0; j < N; j++) {
      if ((A[j] & pow2) == 0) {
        ct0++;
      } else {
        ct1++;
      }
    }
    buf = pow2 * ct0 * ct1;
    ans += (buf % (long long int)(1e9 + 7));
  }
  ans %= (long long int)(1e9 + 7);
  cout << ans << endl;
  return 0;
}
