#include <bits/stdc++.h>
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
using namespace std;
long long ttt = 1;
long long n, a, b[65], p[65], ans;
void solve() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = 60; j > -1; j--)
      if (a >= p[j]) {
        a -= p[j];
        b[j]++;
      }
  }
  for (int i = 0; i < 61; i++)
    ans = (ans + ((b[i] * (n - b[i]) * p[i]) % 1000000007)) % 1000000007;
  cout << ans;
}
int main() {
  p[0] = 1;
  for (int i = 1; i < 61; i++) p[i] = p[i - 1] * 2;
  for (int i = 0; i < ttt; i++) solve();
}
