#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long ans = 0;
  long long INF = 1e+9 + 7;
  for (int i = 0; i < 60; i++) {
    int d1 = 0;
    int d2 = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] & ((long long)1 << i))
        d1++;
      else
        d2++;
    }
    ans += (long long)(1 << i) * d1 * d2;
    ans %= INF;
  }
  cout << ans << endl;
}
