#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<long long> bi(61, 1);
  for (int i = 0; i < 60; i++) bi[i + 1] = 2 * bi[i];
  int N;
  cin >> N;
  vector<pair<long long, long long>> zo(60, make_pair(0, 0));
  for (int i = 0; i < N; i++) {
    long long A;
    cin >> A;
    for (int j = 0; j < 60; j++) {
      if (A % bi[j + 1] / bi[j])
        zo[j].second++;
      else
        zo[j].first++;
    }
  }
  long long sum = 0;
  for (int i = 0; i < 60; i++) {
    sum += zo[i].first * zo[i].second * (bi[i] % 1000000007);
    sum %= 1000000007;
  }
  cout << sum << endl;
}
