#include <bits/stdc++.h>
using namespace std;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;
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;
  for (int i = 0; i < 60; i++) {
    int count_1 = 0;
    for (int j = 0; j < N; j++) {
      if (A[j] & (1LL << i)) {
        count_1++;
      }
    }
    int count_0 = N - count_1;
    long long sum;
    sum = (count_1 * count_0) % mod;
    for (int j = i; j > 0; j--) {
      sum = (sum * 2) % mod;
    }
    ans = (ans + sum) % mod;
  }
  cout << ans << endl;
  return 0;
}
