#include <bits/stdc++.h>
using namespace std;
int ones[70] = {0};
int zeros[70] = {0};
int main() {
  int n;
  long long num;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> num;
    for (int i = 0; i < 60; i++) {
      if (num & (1LL << i)) {
        ones[i]++;
      } else {
        zeros[i]++;
      }
    }
  }
  long long answer = 0;
  for (int i = 0; i < 60; i++) {
    long long x = ones[i] * zeros[i];
    x %= 1000000007LL;
    x *= (1LL << i);
    x %= 1000000007LL;
    answer += x;
    answer %= 1000000007LL;
  }
  cout << answer << endl;
  return 0;
}
