#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main() {
  const ull mod = 1000000007;
  int n;
  ull tmp;
  vector<ull> a;
  vector<vector<int>> bins;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  for (int i = 0; i < n; i++) {
    vector<int> bin;
    for (int j = 0; j < 60; j++) {
      bin.push_back(a[i] % 2);
      a[i] /= 2;
    }
    bins.push_back(bin);
  }
  ull ans = 0;
  for (int j = 0; j < 60; j++) {
    int zeros = 0, ones = 0;
    for (int i = 0; i < n; i++) {
      if (bins[i][j] == 0) {
        zeros++;
      } else {
        ones++;
      }
    }
    tmp = (zeros * ones) % mod;
    for (int k = 0; k < j; k++) {
      tmp *= 2;
      tmp %= mod;
    }
    ans += tmp;
    ans %= mod;
  }
  cout << ans << endl;
}
