#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U> p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T> v) {
  for (int i = 0; i < (int)(v.size()); ++i) {
    if (i) os << ", ";
    os << v[i];
  }
  return os;
}
template <typename T>
T& max(T& a, T& b) {
  if (a >= b) return a;
  return b;
}
template <typename T>
T& min(T& a, T& b) {
  if (a < b) return a;
  return b;
}
template <typename T>
bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;
const int mo = 1e9 + 7;
using Int = long long;
int N;
int counter[65];
signed main() {
  cin >> N;
  for (int i = 0; i < (int)(N); ++i) {
    Int A;
    cin >> A;
    for (int j = 0; j < (int)(63); ++j) {
      if ((A >> j) & 1) counter[j]++;
    }
  }
  Int ans = 0;
  for (int i = 0; i < (int)(63); ++i) {
    ans += (1ll << i) * counter[i] * (N - counter[i]);
    ans %= mo;
  }
  cout << ans << endl;
}
