#include <bits/stdc++.h>
using namespace std;
vector<string> split(const string& s, char c) {
  vector<string> v;
  stringstream ss(s);
  string x;
  while (getline(ss, x, c)) v.emplace_back(x);
  return move(v);
}
void err(vector<string>::iterator it) {}
template <typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
  cerr << it->substr((*it)[0] == ' ', it->length()) << " = " << a << '\n';
  err(++it, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  vector<long long int> c(62, 0);
  for (int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    long long int pos = 0;
    while (x) {
      c[pos++] += x & 1;
      x >>= 1;
    }
  }
  long long int ans = 0;
  long long int curr = 1;
  for (int i = 0; i < 62; i++) {
    ans = (ans + (curr * ((n - c[i]) * c[i]) % 1000000007) % 1000000007) %
          1000000007;
    curr = (curr * 2) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
