#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int, int> > qu2;
priority_queue<int> pq;
static const int NIL = -1;
static const int INF = 1000000007;
deque<int> deq;
long long ans = 0;
long long a[300005];
long long b[65];
long long f[65];
int main() {
  f[0] = 1;
  for (int i = 1; i <= (int)(61); i++) {
    f[i] = f[i - 1] * 2;
  }
  long long n;
  cin >> n;
  for (int i = 1; i <= (int)(n); i++) {
    long long a;
    cin >> a;
    long long k = 0;
    while (a > 0) {
      if (a % 2 == 1) {
        b[k]++;
      }
      a /= 2;
      k++;
    }
  }
  for (int i = 0; i < (int)(61); i++) {
    ans += f[i] * b[i] * (n - b[i]);
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
