#include <bits/stdc++.h>
using namespace std;
const long mod = 1e9 + 7;
const long pow2[] = {
    1,         2,         4,         8,         16,        32,        64,
    128,       256,       512,       1024,      2048,      4096,      8192,
    16384,     32768,     65536,     131072,    262144,    524288,    1048576,
    2097152,   4194304,   8388608,   16777216,  33554432,  67108864,  134217728,
    268435456, 536870912, 73741817,  147483634, 294967268, 589934536, 179869065,
    359738130, 719476260, 438952513, 877905026, 755810045, 511620083, 23240159,
    46480318,  92960636,  185921272, 371842544, 743685088, 487370169, 974740338,
    949480669, 898961331, 797922655, 595845303, 191690599, 383381198, 766762396,
    533524785, 67049563,  134099126, 268198252, 536396504};
vector<int> getketa(long n, int c) {
  vector<int> ret(c);
  for (int i = 0; i < c; i++) {
    ret[i] = n % 2;
    n /= 2;
  }
  return ret;
}
int cnt1(vector<int> v) {
  int ret = 0;
  for (int i : v) {
    if (i == 1) ret++;
  }
  return ret;
}
int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n);
  vector<int> num1(61, 0);
  for (int i = 0; i < n; i++) {
    long ar;
    cin >> ar;
    a[i] = getketa(ar, 61);
  }
  for (int i = 0; i < 61; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j][i]) num1[i]++;
    }
  }
  long ret = 0;
  for (int i = 0; i < 61; i++) {
    ret += ((num1[i] * (n - num1[i])) % mod) * pow2[i];
    ret %= mod;
  }
  cout << (ret * 500000004) % mod;
  return 0;
}
