#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int cnt1[61] = {0};
  cin >> n;
  long long int a[300001];
  long long int b[300001][61];
  long long int mod, ans;
  mod = 1000000007;
  long long int c[61];
  long long int temp = 1;
  c[0] = 1;
  for (int i = 1; i < 60; i++) {
    temp = temp * 2 % mod;
    c[i] = temp;
  }
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      b[i][j] = a[i] % 2;
      a[i] / 2;
    }
  }
  for (int j = 0; j < 60; j++) {
    for (int i = 0; i < n; i++) {
      if (b[i][j] == 1) cnt1[j]++;
    }
  }
  for (int i = 0; i < 60; i++) {
    ans = (ans + (cnt1[i] * (60 - cnt1[i]) * c[i]) % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
