#include <bits/stdc++.h>
static const double pi = 3.141592653589793;
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int mod = 1e9 + 7;
int A[100];
int B[100];
long long N, ans;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; i++) {
    long long cur;
    cin >> cur;
    int cnt = 0;
    for (int j = 0; j < 100; j++) {
      if (cur % 2 == 1)
        A[cnt]++;
      else
        B[cnt]++;
      cur /= 2;
      cnt++;
    }
  }
  long long cur = 1;
  for (int i = 0; i < 100; i++) {
    ans = (ans + A[i] * B[i] * cur + mod) % mod;
    cur = (cur * 2) % mod;
  }
  cout << ans % mod << endl;
  return 0;
}
