#include <bits/stdc++.h>
using namespace std;
long long n;
vector<vector<vector<long long>>> g(
    15 + 1, vector<vector<long long>>(2, vector<long long>(0)));
long long ret(long long i, vector<long long> l, long long res) {
  if (i == n + 1) {
    bool flag = true;
    for (long long j = 1; j <= n; j++) {
      if (l[j] == 0) continue;
      for (auto a : g[j][1]) {
        if (l[a] != 1) flag = false;
      }
      for (auto a : g[j][0]) {
        if (l[a] != 0) flag = false;
      }
      if (not flag) break;
    }
    if (flag) {
      return res;
    } else {
      return 0;
    }
  }
  vector<long long> l1 = l;
  l1[i] = 1;
  return max(ret(i + 1, l, res), ret(i + 1, l1, res + 1));
}
int main() {
  long long n;
  cin >> n;
  vector<long long> v(60, 0);
  for (long long(i) = 0; (i) < (n); (i)++) {
    long long a;
    cin >> a;
    for (long long(j) = 0; (j) < (60); (j)++) {
      if (a & 1) v[j] += 1;
      a >>= 1;
      if (a == 0) break;
    }
  }
  long long ans = 0;
  long long k1 = 1;
  for (long long(i) = 0; (i) < (60); (i)++) {
    long long k2 = k1 * v[i] * (n - v[i]) % 1000000007LL;
    ans = (ans + k2) % 1000000007LL;
    k1 = k1 * 2 % 1000000007LL;
  }
  cout << ans << endl;
}
