#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long t = 60;
void input() {
  long long n;
  scanf("%lld", &n);
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
  vector<string> mat;
  for (int i = 0; i < n; ++i) {
    bitset<t> temp(a[i]);
    string s = temp.to_string();
    reverse(s.begin(), s.end());
    mat.push_back(s);
  }
  vector<vector<long long> > one_cnt(n, vector<long long>(t, 0)),
      zero_cnt(n, vector<long long>(t, 0));
  for (int i = 0; i < t; ++i) {
    for (int j = 0; j < n; ++j) {
      one_cnt[j][i] += (mat[j][i] == '1') ? 1 : 0;
      zero_cnt[j][i] += (mat[j][i] == '0') ? 1 : 0;
    }
  }
  for (int j = 0; j < t; ++j) {
    for (int i = n - 2; i >= 0; --i) {
      one_cnt[i][j] += one_cnt[i + 1][j];
      zero_cnt[i][j] += zero_cnt[i + 1][j];
    }
  }
  long long ans = 0LL;
  long long k = 1LL;
  for (int i = 0; i < n - 1; ++i) {
    k = 1LL;
    for (int j = 0; j < t; ++j) {
      if (mat[i][j] == '1') {
        ans = (ans + (k * ((long long)zero_cnt[i + 1][j])) % mod) % mod;
      } else {
        ans = (ans + (k * ((long long)one_cnt[i + 1][j])) % mod) % mod;
      }
      k = (k * 2LL) % mod;
    }
  }
  printf("%d\n", (int)ans);
}
int main() {
  input();
  return 0;
}
