#include <bits/stdc++.h>
using i64 = int64_t;
using namespace std;
template <size_t I, class H, class... T>
struct TupleReaderWriter {
  static tuple<H, T...> r(istream &i) {
    H v;
    i >> v;
    return tuple_cat(tuple<H>(v),
                     TupleReaderWriter<sizeof...(T) - 1, T...>::r(i));
  }
  static void w(ostream &o, tuple<H, T...> &t, string d) {
    TupleReaderWriter<I - 1, H, T...>::w(o, t, d);
    o << d << get<I>(t);
  }
};
template <class H, class... T>
struct TupleReaderWriter<0, H, T...> {
  static tuple<H, T...> r(istream &i) {
    H v;
    i >> v;
    return tuple<H>(v);
  }
  static void w(ostream &o, tuple<H, T...> &t, string d) { o << get<0>(t); }
};
template <class... T>
istream &operator>>(istream &i, tuple<T...> &t) {
  t = TupleReaderWriter<sizeof...(T), T...>::r(i);
  return i;
}
template <class... T>
ostream &operator<<(ostream &o, tuple<T...> &t) {
  string delim = " ";
  TupleReaderWriter<sizeof...(T) - 1, T...>::w(o, t, delim);
  return o;
}
template <class T>
istream &operator>>(istream &i, vector<T> &v) {
  for (auto &x : v) i >> x;
  return i;
}
template <class T>
ostream &operator<<(ostream &o, vector<T> &v) {
  string delim = "";
  for (auto &x : v) o << delim << x, delim = " ";
  return o;
}
template <class T>
using rev_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template <class T>
using vector2d = vector<vector<T>>;
struct fixprec {
  int x;
  fixprec(int d) : x(d) {}
};
ostream &operator<<(ostream &o, fixprec f) {
  return o << fixed << setprecision(f.x);
}
void R_YESNO(bool p) { cout << (p ? "YES" : "NO") << endl; }
void R_YesNo(bool p) { cout << (p ? "Yes" : "No") << endl; }
const i64 MOD = 1e9 + 7;
int64_t powmod(int64_t a, int64_t p) {
  int64_t v = 1;
  for (int64_t b = a; p > 0; p >>= 1, b = (b * b) % MOD) {
    if (p & 1) v = (v * b) % MOD;
  }
  return v;
}
int64_t invmod(int64_t x) { return powmod(x, MOD - 2); }
int main() {
  int N;
  i64 m = 1;
  cin >> N;
  vector<i64> A(N);
  for (auto &x : A) cin >> x;
  i64 ans = 0, carry = 0;
  for (int i = 0; i < 63; i++) {
    i64 tmp = 0;
    for (i64 x : A) {
      tmp += (x >> i) & 1;
    }
    carry += 2 * tmp * (N - tmp);
    ans += (carry % 2) * m;
    ans %= MOD;
    carry /= 2;
    m = (2 * m) % MOD;
  }
  ans = (ans * invmod(2)) % MOD;
  cout << ans << endl;
  return 0;
}
